Wildcards and temp directory
Posted: Sun Nov 07, 2010 12:44 pm
Hello Guys,
I have an upload script that uploads temp images to a directory called "temp_photo" and each of the images are named by the session first name.last name plus a random number like this for example - johnsmilh21.jpg or johnsmith45.jpg
First thing that I want to do is look in the temp folder to see if the images exists
Not sure what the wild card for the number is.
What would you use to look in the folder and maybe not only see if it exists but also to grab all the names of the images?
I then want to be able to move those images to a perm directory..
Thanks for your help
I have an upload script that uploads temp images to a directory called "temp_photo" and each of the images are named by the session first name.last name plus a random number like this for example - johnsmilh21.jpg or johnsmith45.jpg
First thing that I want to do is look in the temp folder to see if the images exists
Code: Select all
$subn = $_SESSION['fname'] . $_SESSION['lname'] ;
$filename = "temp_photo/$subn*.jpg";
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}What would you use to look in the folder and maybe not only see if it exists but also to grab all the names of the images?
I then want to be able to move those images to a perm directory..
Thanks for your help