通过 Javascript 从 FTP 下载文件 [英] Download file from FTP via Javascript

查看:123
本文介绍了通过 Javascript 从 FTP 下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件服务器和一个 Web 服务器.它们在物理上不同的机器上运行.

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

我想通过 JavaScript 从 FTP 服务器下载一个文件.我必须通过 JavaScript 执行此操作的原因是我有一个外部应用程序,我只能将 JavaScript 注入该应用程序.

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.

基本上,我需要指定ftp地址用户名和密码.但我担心安全性,因为人们可以查看 FTP 凭据.

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?

感谢您的帮助

问候

推荐答案

Javascript 只支持 HTTP 和 WebSockets(在较新的浏览器上),不支持 FTP.在这种情况下,将所有内容都保留在客户端,您可能必须编写一个 Flash 或 Java 小程序来处理实际的 FTP 协议,并与 Javascript 接口以提供交互性.

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.

除非您打算将浏览器重定向到 ftp 站点,并传入用户名和密码?您是否担心用户获取 FTP 信息,或者您是否担心嗅探明文 FTP 凭据的中间人攻击?

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?

这篇关于通过 Javascript 从 FTP 下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆