Re: [PHP] Re: Strategy for Secure File Storage
- From: php@xxxxxxxxxxxxxxxxxx (Kevin Murphy)
- Date: Mon, 24 Sep 2007 15:34:10 -0700
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.
- Follow-Ups:
- Re: Strategy for Secure File Storage
- From: Colin Guthrie
- Re: [PHP] Re: Strategy for Secure File Storage
- From: brian
- Re: Strategy for Secure File Storage
- References:
- Strategy for Secure File Storage
- From: Kevin Murphy
- Re: Strategy for Secure File Storage
- From: Colin Guthrie
- Strategy for Secure File Storage
- Prev by Date: Re: Data request
- Next by Date: Re: [PHP] Questions about overloading and visibility in PHP5
- Previous by thread: Re: Strategy for Secure File Storage
- Next by thread: Re: [PHP] Re: Strategy for Secure File Storage
- Index(es):
Relevant Pages
|