Re: Re: Strategy for Secure File Storage

From: Date: Mon, 24 Sep 2007 22:34:10 +0000
Subject: Re: Re: Strategy for Secure File Storage
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262434@lists.php.net to get a copy of this message
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.

« previous php.general (#262434) next »