views:

225

answers:

3

Hi! I am currently develope something using asp.net MVC, im still quite not experience with it so please help me out.

I have a form for user to upload Video. The current ideal concept to upload to remote server is to Upload it to to the current server, then use FTP to push it to a remote server.

For me, this is not quite fast since you have to upload to current server (Time x1) and then the current server push to new server (Time x2) so it's double the time.

So my idea is to make user upload it to the current server, and WHILE user is uploading, the current server add the file to DB and also send the file to the remote server at the same time using SFTP...

is it posible and are there any security hole in this concept?

Thank you very much

A: 

You could upload directly to SFTP using a java applet. These applets have hooks to let you (the ASP.NET MVC application) know when the upload is done.

Mauricio Scheffer
+1  A: 

I'd recommend using the NULL Ftp Server for your testing. If you connect to it using Filezilla client you'll notice that it prompts the user to accept the ssl key. It does that in the same way that putty.exe or any SSH client does.

So, you code just needs to accept the SSL connection and then from that point forward it is just regular FTP commands.

Programmatically, I dont know how to accept the cert and so all I can suggest is that you set up a batch file to run the Putty sftp client and push files and then have your code call the batch file. I'm pretty sure ASP supports calling a batch file.

djangofan
so basically i can receive the byte from user synchronously and in the same time, i connect to the SFTP server and upload it? :)
DucDigital
the batch file idea i posted above is not synchronous. i would recommend doing it programatically in order to be synchronous. But the example I gave above might help you understand the situation better. also, you can use WireShark to trace the traffic during the test to understand what is going on.
djangofan
oh, thanks, i will write my solution here for anyone found this post... Basically, there's a way to receive byte and save to disk directly without load any data to RAM, it's a loop to save byte to disk, i basically replace the save to disk to send byte to remote server... If fail auto matically remove file from the target server. Hope this help people who look for the same problem...
DucDigital
+1  A: 

I had another idea. You can buy the $30 version of WinSCP and it will synchronize a local directory with a remote SFTP directory. That would save you the trouble of programming it.

djangofan
that's a great idea. lol :">
DucDigital