views:

81

answers:

2

Hi,

I need to resize an uploaded image. The class that resizes needs to get the location of the image to be worked with. It returns the image in a variable.

However, when I try to get the path to the image, I get from $_FILES['profile_upload']['tmp_name'] the following: C:\xampp\tmp\php1C5.tmp I don't get the actual file, even though the tmp folder contains it!

How can I get the actual filename? Another question - for how long are the files stored in tmp, and when do they get deleted?

By the way, does the Zend Framework have a good image manipulation interface?

+3  A: 

You should complete the whole file upload setup with something similar and then the variable $_FILES['uploadedfile']['name'] will also contain the original file name:

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
Shadi Almosri
+1  A: 

To address your second point: Files are stored until the script they were uploaded to finishes.

Greg