Jump to content

download thru php///


popmotsy

Recommended Posts

<a href="http://MySite.com/downloads/1.jpg">Download This!</a>

 

That is html...

 

 

If you would like to have it so people can ONLY download from the script and (almost) never directly, use php header..

 

header("Content-Type: application/zip");
header('Content-Disposition: attachment; filename="1.zip"');
readfile('/downloads/a7375498_848jfkjJGJSD/1.zip');
die();

 

For the header, you can change the filename="" to anything that you want ('fool' the user..)

The readfile() MUST be the path to the actual file or the file will show as 0kb and won't be anything..

Link to comment
https://forums.phpfreaks.com/topic/150017-download-thru-php/#findComment-787861
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.