Php server prompts the download function solution

Source: Internet
Author: User
Tags php server
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, ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.