Jump to content

"force" a download


PC Nerd

Recommended Posts

Hi guys.

 

Ive got the following code.  however its telling me to download itself ( download.php), and not the file in the $_GET data...


<?php
header("Content-type: application/".$_GET['type']."");
header("Content-Disposition: attachment; ".$_GET['file'].";");
readfile("$_GET['file']");
?>

 

 

is this the correct code or do i need to try something different?  The data type will change.  at the moment the data types are as following:  .py, .java, .zip, .js( not sure).  We may also be downloading .exe etc.  *its a programmign website.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/70442-force-a-download/
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.