bug_php Tutorial to write php download pictures

Source: Internet
Author: User
Today to write the project encountered a bug, write download image function Click Download is not read the picture, the path also tried a lot of methods are wrong, feeling very depressed. Finally put my classmate's code admitted or can not use, I was thinking in his that how can use? How can I not, depressed for nearly 30 minutes finally he said the header can not have data it, then I suddenly enlightened is ah, should be emptied, immediately out of breath, so small problem delayed nearly a lesson, so I want to share it to everyone do not make such a mistake again

The code is as follows:

/upload Path


[HTML]
$filename =$_get["Photo"];
Clear the above information
Ob_clean ();
Header ("Content-type:image/pjpeg");
Header ("Content-disposition:attachment;filename=". $filename);
Header ("Content-length:". FileSize ($filename));
ReadFile ($filename);


Excerpt from Siwena's column

http://www.bkjia.com/PHPjc/478283.html www.bkjia.com true http://www.bkjia.com/PHPjc/478283.html techarticle //write a project today encountered a bug, write download image function Click Download is not read the picture, the path also tried a lot of methods are wrong, feeling very depressed. Finally put my classmate's generation ...

  • 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.