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.

有帮助吗?

解决方案

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.

其他提示

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.

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top