Apache – Silverlight Ftp Upload

apacheftpsilverlight

I'm working on trying to ftp a file to the server through a silverlight application. Where the location to upload the file on server file system, exists outside the sandbox area for the web server. In this case the web server root exists at "C:\test\www\" and the location to upload the file will exist at "C:\User\Uploads". In this scenerio i'm not sure if Http POST will work (doesn't that use the web server root). I just need to upload the file selected by the user to a different location that may exist outside the sandbox. With silverlight i'm thinking sockets are my last option based on the limited port range for silverlight being 4502-4532. Can i do this using WebClient and Http POST? Can i make an ftp connection through silverlight or javascript?

Best Answer

This is an interesting scenario, since it sounds like you are doing this all on the same machine (both client and server). I am responding to the vague original question, and would love additional data to help answer this completely.

FTP uploading itself is not supported by Silverlight, but the concept of uploading a file is, through an HTTP stream of data.

If you want to do an HTTP upload from a client machine to the server: You can use the OpenFileDialog control in Silverlight 2 and 3 to read that data, then use WebClient to upload it.

If you want to do a download from something your web server can send, to the client machine, then you'd need to use Silverlight 3 or newer, which features a SaveFileDialog control.

All Silverlight file dialogs require a user-initiated action for them to work, function, and the user will need to select the file name(s) for security purposes.

Hope this helps!

Related Topic