PHP Server prompt Download function
I here is the PC server, and now other computers to visit me here, need to prompt the download function, how to implement it?
It's like writing a download in index.php? There is no experience at all, and I do not know what to do.
I added this section.
PHP Code
And then what to do?
------Solution--------------------
Then visit this page on another computer.
------Solution--------------------
Do you want to make a link directly with HTML code?
------Solution--------------------
Filename=aa.rar//A name is to be taken here. Otherwise the RAR file will be formed.
------Solution--------------------
PHP code
#down. Php$file = ' asdfggg.pdf '; _download ("Files_dir /". $file, $file); function _download ($f _location, $f _name) {header (" cache-control:must-revalidate, post-check=0, pre- Check=0 "); Header (' Content-description:file Transfer '); Header (' Content-type:application/octet-stream '); Header (' Content-length: '. FileSize ($f _location)); Header (' content-disposition:attachment; Filename= '. basename ($f _name)); ReadFile ($f _location);
------Solution--------------------
discussion
I added these 3 lines of code to the localsettings.php:
PHP Code
Header ("Content-type:application/rar");
Header ("Content-disposition:attachment;filename=sqlite.rar");
ReadFile ("E:\ziptest\SQLite.rar");
Login to the first page, there is a download prompt, but ...