Jump to content

Recommended Posts

i have a this script

 

move_uploaded_file($_FILES['ufile']['tmp_name'][1],$path1);

if(is_uploaded_file($_FILES['ufile']['tmp_name'][1])){

echo "Upload successful";}

 

i get file that has been uploaded inside upload folder but i dont know why the echo "Upload successful" didnt appear

 

thx

Link to comment
https://forums.phpfreaks.com/topic/209113-is_uploaded_file-problem/
Share on other sites

Because you move it from spot X to spot Y, and then check spot X to see if it is there (which it isn't).  :P  Try:

 

if(is_uploaded_file($_FILES['ufile']['tmp_name'][1])){
   if(move_uploaded_file($_FILES['ufile']['tmp_name'][1],$path1)) {
      echo "Upload successful";
   }
}

thx a lot it works...but i still confused  :confused: :confused:

 

Is it true that is_uploaded_file used to check whether the file has been successfully uploaded??

 

if it is, then logically we have to upload the file first into the upload folder before check it....could you give me some explanation for this.... i always use copy() n wish to learn how to use move_uploaded_file as it is much safer  :)

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.