Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download file from FTP via Javascript

Tags:

javascript

ftp

I have a got a file server and a web server. They are running on physically different machines.

I would like to download a file from the FTP server via JavaScript. The reason I have to do it via JavaScript is that I have an external application and I can only inject JavaScript into that application.

Basically, I need to specify ftp address username and password. But I am concerning about security as people can view FTP credentials.

What is the best way to implement such scenario?

Thanks for your help

Regards

like image 392
AnarchistGeek Avatar asked Jan 04 '11 14:01

AnarchistGeek


1 Answers

Javascript only speaks HTTP and WebSockets (on newer browsers), and not FTP. In that situation, keeping it all on the client-side, you'd probably have to write a Flash or Java applet that handles the actual FTP protocol, and interface with Javascript to provide interactivity.

Unless you're planning on redirecting the browser to the ftp site, passing in the username and password? Are you concerned about the users getting the FTP information, or are you concerned with man-in-the-middle attacks sniffing the plaintext FTP credentials?

like image 151
Alex Vidal Avatar answered Oct 06 '22 00:10

Alex Vidal