Forum Moderators: coopster
I am setting up a mini file upload/retrieve system.
The way I am tackling this is having all the files stored outside of the htdocs folder, a.k.a. ../files/, so they can't be accessed publically.
Now I use a similar method for storing images and I use PHP to read and send out the images so people can view them.
e.g.
$img = @imagecreatefromjpeg ("../tmp/{$thumb}");
header("Content-type: image/jpeg");
imagejpeg($img);
imagedestroy($img);
exit ();
What I can't seem to figure out is how to achieve this with ordinary files. Firstly, I would need to get the MIME type for the header, and secondly I would need read and output the file.
Firstly, is this possible? Secondly, is there a better way of doing it?
Thanks.