Stream file rather than downloading
I wish I could do this on Windows as well.
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
GetFile
method with FTPS.
GetFileToDirectory
method.
FtpWebRequest
class. Though it has its limitations. For example it does not support TLS/SSL session resume. What can indeed be a showstopper (now or later).
Advertisement
PutFile
method so we're only catching those during our upload loop and not everything.
foreach (var file in files) { try { var transferfilename = Approvals.GetTransferName(); var transfercontent = Approvals.GetTransferContent(file.Content); var remotepath = $"{Configuration["SftpInbox"]}/{transferfilename}"; var byteArray = Encoding.ASCII.GetBytes(transfercontent); var stream = new System.IO.MemoryStream(byteArray); session.PutFile(stream, remotepath, options); await Approvals.SetTransferNameAsync(file.RowKey, transferfilename, DateTime.UtcNow); await Approvals.SetStatusAsync(file.RowKey, CitStatus.Transferred); } catch (Exception ex) { //I catch everything here, but I'm only concerned with the exception //throw for this single file upload await Approvals.SetStatusAsync(file.RowKey, CitStatus.TransferError); } }
Session.PutFile
throws the same exceptions as Session.PutFiles
does:
This is exactly our issue.FTPS (and streaming) is supported by the native .NETFtpWebRequest
class. Though it has its limitations. For example it does not support TLS/SSL session resume. What can indeed be a showstopper (now or later).
Advertisement
You can post new topics in this forum