Thanx for that, I had to hack around a bit coz I'm testin on XP.
Nevertheless, I got it working as intended.
I think you missed the '.' in jpg in $fp & $data.
&
I put $secret_prefix before $n
I'm now onto stage 2:
Q1. Any ideas on how I can efficiently expand this for 'gif's
One other thing:
Q2. Each user can upload more than 1 image (upto 10).
I've done this previously on another site and at the upload stage I've renamed each file $profile_id_1.jpg, $profile_id_2.gif etc. but checking the existence of files for display purposes (users gallery) can be a bit messy especially when they might have deleted 3.jpg when 2.jpg and _4.jpg remain.
Anyone have any better ideas, maybe with a MySQL table?
Thanks again!
Here's the final working for anyone else:
<?
$path = "d:/html/mysite/";
$secret_prefix = "hidepix_"; // Again jus an additional precaution
//Jus a simple NON through safety precaution
$name = str_replace("..","",$_GET['n']); //Jus a simple NON through safety precaution
//Open the file
$fp = fopen($path.$secret_prefix.$n.".jpg","rb");
$data = fread($fp,filesize($path.$secret_prefix.$n.".jpg"));
fclose($fp);
//Send the header
header('Content-Type: image/jpeg');
echo $data;
?>
😉