The php server prompts the download function. I am working as a server on the PC. when other computers access me, I need to prompt the download function. how can this problem be achieved? Does it seem like writing and downloading in index. php? I have no experience in this field and do not know how to do it. I added this PHPcode & lt ;? Phpheader (& qu php server prompts download function
I am working as a server on a PC. when other computers access me, I need to prompt the download function. how can this problem be achieved?
Does it seem like writing and downloading in index. php? I have no experience in this field and do not know how to do it.
I added this section.
PHP code
What should I do?
------ Solution --------------------
Then visit this page on another computer.
------ Solution --------------------
Can I directly create a link using html code?
------ Solution --------------------
Filename=aa.rar // you need a name here. Otherwise, a rar file will be generated.
------ Solution --------------------
PHP code
# Down. php $ file = 'asdfgggout'; _ 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 three lines of code to LocalSettings. php:
PHP code
Header ("Content-type: application/rar ");
Header ("Content-Disposition: attachment?filename=sqlite.rar ");
Readfile ("E: \ ziptest \ SQLite.rar ");
When logging on to the homepage, a download prompt is displayed, ......