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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.