Hello all,
Is it possible to view (like a preview) an image that a user uploads before it gets stored on a server (in db or filesystem)?
In other words, i'd like to be able to give the user a preview of their image (along with other data uploaded) before they actually "submit" this image to be stored. I'd like to stay away from having to write it to a temp directory, then deal with moving it or deleting it depending on the situation.
here's a bit of what i've tried (but it doesn't work of course), where $photo is the uploaded file:
if ($photo != "") {
$photoSize=GetImageSize($photo);
if ($photoSize[2]=="1") {
$tempPhoto=$photo.".gif";
rename ($photo,$tempPhoto);
} elseif ($photoSize[2]=="2") {
$tempPhoto=$photo.".jpg";
rename ($photo,$tempPhoto);
} elseif ($photoSize[2]=="3") {
$tempPhoto=$photo.".png";
rename ($photo,$tempPhoto);
}
chmod($tempPhoto,0755);
echo "<img src=\"$tempPhoto\" border=\"0\">";
any ideas?
Thanks.