got a website where users view or download docs and pics they uploaded earlier.
let me show you what is working before I present the problem.
user clicks a link to their doc or image and browser opens it in new window.
browser url bar shows something like: mysite.com/files/box/data/278/myimage.jpg
ALL IS WELL, this is working fine.
HOWEVER, I want to add a bit of security to keep users out of other people's folders.
ie, can't have them changing url to something like: mysite.com/files/box/data/456/mytaxes2011.pdf
SO, using .htaccess I intercept all requests to /data/ and check authorization. once they get the green light, I open the file and pass it to the browser:
// Open the file for reading
$fp = fopen($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'], 'r');
// Set mime type to header
header('Content-type: '.mime_content_type($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']));
// Send the contents of the file the browser
fpassthru($fp);
fclose($fp);
HERE IS THE PROBLEM: headers getting screwed up. files do not open properly. not working in IE, FF, or CHROME. both before and after my security mod, identical REQUEST HEADERS are being sent:
Bookmarks