Re: Re: Strategy for Secure File Storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I'm almost there. I took what everyone said (and a few Google searches later) and built this, which works great on Firefox and Safari (both mac and PC). The $path leads to a directory outside the web root, and there is also an array with all the mime types in it ($mimetype).


$file_path = $path."/".$file;

$ext = explode(".",$file);

$filesize = filesize($file_path);

$extension = $mimetypes["$ext[1]"];

header("Content-type: $extension");
header("Content-length: $filesize");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Pragma: no-cache");
$file = file_get_contents($file_path);
echo ($file);

The problem is IE7. All browsers work with this code as is but IE says "Internet Explorer cannot download test.pdf from XXX...."

Any suggestions?

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326

P.S. Please note that my e-mail and website address have changed from wncc.edu to wnc.edu.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux