tags:

views:

255

answers:

3

I'm using C# and i have written a locally installed application that dynamically generates files which need to be on an FTP server.

Do i generate them to disk then upload them to the FTP server? or is there a way to open a stream to an FTP server and write the files directly?

A: 

Since you are using c# I'm thinking maybe you are in a Windows Env. Something I know little about :)

If you are dealing with a unix env, you could just pipe your output thru SSH, which would also take care of encryption overhead.

Jeff MacDonald
A: 

You should follow the class:

System.Net.FtpWebRequest

You will see that its arguments are streams and you can send data to them from any source.

When seaching for .Net capabilities you should be aware of the object browser for visual studio acessible in:

View > other windows > object browser

Is supplies a search over all known assembly .Net objects.

Caerbanog
Thanks for the info, much appreciated.
Gary Willoughby
+1  A: 

Check the code sample I gave in this answer, doesn't rely on writing to files. It's not SQL specific and was just a suggestion on how to use SQL CLR integration assemblies to upload output from sql queries to an FTP server. The for loop in the method is just to demonstrate writing to the FTP stream. You should be able to rework to you needs:

http://stackoverflow.com/questions/20587/execute-stored-procedure-sql-2005-and-place-results-into-a-csv-file-on-a-ftp-lo#20689

Kev