How to download file in computer silently using PHP? [closed]

偶尔善良 提交于 2019-12-02 23:51:42

问题


I want to download the files silently or without prompt to the computer using PHP? OR when click on the download link, can I force to download in defining location? Like C: /dir/dir/myfile.zip? Note that I am asking this for my internal use only, nothing to harm the users.


回答1:


You can't.

It simply isn't possible, due to security issues.

Now, if these are systems on your own private network, and drives are shared and what not, you could write code to write out the files from the server. But, that is all outside of the user's browser. Other methods have included external applications running on the user's computer. When they click a link, the file to be downloaded is added to a queue in a database. The client application gets this data and will download it. AudioGalaxy used to use this method.




回答2:


It's actually quite simple. Make them download an executable. They then need to execute it, and that executable than can take care to install a plugin into their browser that is able to write to disk and all that fun.




回答3:


First of all, PHP is not client side language so something like this is not possible to do it in.

Next, as you can see in comments on your question, due to security reasons such actions are not allowed by browsers.



来源:https://stackoverflow.com/questions/12863314/how-to-download-file-in-computer-silently-using-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!