Home > Backend Development > PHP Tutorial > PHP implements the method of changing the image to open directly for download, _PHP tutorial

PHP implements the method of changing the image to open directly for download, _PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:57:16
Original
971 people have browsed it

PHP implements the method of changing the picture to be directly opened for download.

This article describes the example of php to implement the method of changing the picture to be directly opened for download. Share it with everyone for your reference. The details are as follows:

The process.php file is as follows:

$file = $_GET['file'];
header("Content-type: octet/stream");
header("Content-disposition:attachment;filename=".$file.";");
header("Content-Length:".filesize($file));
readfile($file);
exit;
Copy after login

The html file is as follows:

<a href="process.php&#63;file=pic.jpg">Image goes Here</a>
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/984003.htmlTechArticlephp method to change the picture to open directly for download. This article describes the method of php to change the picture to open directly for download. method. Share it with everyone for your reference. The details are as follows: p...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template