Re: [PHP] Re: Strategy for Secure File Storage



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.

Relevant Pages

  • Re: Olympic Site Video
    ... Explorer 6, 7 for Windows ... Firefox 1.5,2,3 for Windows ... Safari 2 & 3 for Mac ...
    (alt.os.linux.suse)
  • Re: Safari crashing on Panther 10.3.9
    ... date version of safari available - if so then that might cure it. ... for Mac OS X 10.3 after Mac OS X 10.3.9. ... Opera, Camino, or something else. ... with Camino or Firefox. ...
    (uk.comp.sys.mac)
  • Re: Safari crashing on Panther 10.3.9
    ... date version of safari available - if so then that might cure it. ... for Mac OS X 10.3 after Mac OS X 10.3.9. ... Opera, Camino, or something else. ... with Camino or Firefox. ...
    (uk.comp.sys.mac)
  • Re: Most widely used browser(s) for Apple/Macintosh?
    ... for Apple/Macintosh and what percentage of the Mac market do they have? ... Safari and Firefox (handy extensions and ad ... browsers with small shares. ...
    (comp.infosystems.www.authoring.html)
  • Re: Olympic Site Video
    ... Internet Explorer 6, 7 for Windows ... Firefox 1.5,2,3 for Windows ... Safari 2 & 3 for Mac ... I set Konqueror to tell that site I was using Safari 2 on OSX, ...
    (alt.os.linux.suse)