Download file from FTP via Javascript

前端 未结 4 1083
北荒
北荒 2020-12-11 05:13

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. T

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 05:49

    If by "downloading" you mean "prompt user to save a file from external link" (which basically means open a new window with URL that points to a file) then you can just point user to a script you have control over.

    window.open('http://myserver/get_file/filename');
    

    And your server-side get_file script will do all the work of connecting to a FTP and fetching a file

提交回复
热议问题