Jump to content

Headers - Downloading .exe's


peter_anderson

Recommended Posts

Hi there,

 

I'm trying to allow my customers to download the files they have purchased.

 

The file is store off the server (on most occasions), so $file is http://example.com/whatever.ext.

 

Here's my code (unnecessary stuff cut)

 

<?php
// cut
$file = $row2['file'];
//header("Location: $file");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"$file\"");
// cut
?>

 

However, when I test it, .exe files don't register as exe's when they are downloaded (on my PC), so I think something is making the client download it as a different file type?

 

Can anyone suggest how to fix it?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/196005-headers-downloading-exes/
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.