Jump to content

Get the Temporary Directory of the Uploaded File?


Glese

Recommended Posts

After the file gets uploaded, I intend the file to become renamed, and then moved to its destination folder.

 

Though to move the file, I need the newly renamed file name and also its location, which is the temporary folder, and the latter describes my question.

 

This is the script as follows:



$avatar_tmp = $_FILES['avatar_upload']['tmp_name'];



                                // Rename the file into a more usable file name
                                $new_file_name = $user_name . '_' . rand(111111, 999999) . '.jpg';    
                                
                                rename($avatar_tmp, $new_file_name);     
                                    
       
                            
                                                                                          
                                // Move the uploaded file on the disk to its folder
                                 
                                // The directory of the temporary folder is needed in front of the new_file_name variable
                                                              
			move_uploaded_file ($new_file_name, $target);

 

 

The directory of the temporary folder is needed in front of the new_file_name variable and my question is, is there any function, to get the directory of the temporary folder for the uploaded file? So I can insert it in front of the new_file_name variable and move it out of the folder to its destination folder?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.