Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with http header for download script

Status
Not open for further replies.

paniker

Programmer
Aug 5, 2001
1
DE
Do you now a possibility to send an http-header that forwards you to an new location (in my case a new file that is supposed to be downloaded) and also suggests a new filename for this certain file (e.g. using Content-Disposition).

I tried this:

<?php
header(&quot;Content-Type: application/octet-stream&quot;);
header(&quot;Location: header(&quot;Content-Disposition: attachment; filename=file.exe&quot;);
?>
 
You need to make it one header call, once headers are sent...you can't send anymore.

<?php
header(&quot;Location: ?>

That should be all you need to get them to get the file, the browser will ask them if they want to download it automatically. - PAINKILLER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top