Archived Forum Post

Index of archived forum posts

Question:

Real time encryption and S/FTP upload

Oct 18 '12 at 18:22

Hello,

I'm working on an S/FTP application with file encryption. It's based on this example. Is there any way to stream only chunks of the files because it's using a lot of memory with big files.

Thank you!


Answer

I'm confused because you indicate you are working on an S/FTP (Secure File Transfer over SSH) application, but the example you cited was for FTP. Which is it? SFTP or FTPS?


Answer

Sorry, I was misunderstandable! The two methodes (SFTP and FTP) are selectable. The FTP part is working with the example above.

I mixed the example with this, when SFTP is selected.


Answer

With the SFTP API (such as for the example here: http://www.example-code.com/vbdotnet/sftp_writeBinary.asp ), the methods are similar to typical file I/O. You open a file for writing (or to create it), you then write to the open file. You may call the sftp.WriteFileBytes method any number of times. If you are streaming a large file, then you may write the file chunk-by-chunk by calling sftp.WriteFileBytes for each chunk. When you are done writing, you close the file by calling sftp.CloseHandle.