简体   繁体   English

是否可以使用JavaScript将文件下载到服务器

[英]Is it possible to download file to the server using JavaScript

Every time user click specific button, my javascript code needs to send request to the different server, and download a file to my server, than process it. 每次用户单击特定按钮时,我的javascript代码都需要将请求发送到其他服务器,然后将文件下载到我的服务器,而不是对其进行处理。

Is it possible to do? 有可能吗?

JavaScript by itself would not be able to do this, as it is a Client-side scripting language , meaning it runs entirely on the user's browser and has little to do with the server itself. JavaScript本身不能执行此操作,因为它是一种客户端脚本语言 ,这意味着它完全在用户的浏览器上运行,而与服务器本身无关。

However, it would be entirely possible to do this with PHP (or any other server-side language), and then have JavaScript tell the server to run the PHP script to download and process the file. 但是,完全有可能使用PHP(或任何其他服务器端语言)执行此操作,然后让JavaScript告诉服务器运行PHP脚本来下载和处理文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM