Page 1 of 1

problem with file to upload to the server : SOLVED

Posted: Sun Oct 30, 2005 4:18 am
by orangeapple
Hi !

I have a problem with an file upload module. It works perfectly in local but the file is not saved on the server.
Is it a writting right problem on the server?

Thanks for your help !

Posted: Sun Oct 30, 2005 7:01 am
by yum-jelly
Just check each upload process to see what is going wrong! All upload functions and file handling functions return BOOL true or false.

Code: Select all

if ( move_uploaded_file ( $_FILES['up']['tmp_name'], 'some_path_some_file.some_ext' ) !== false )
	{
		echo 'nice file move';
	}
	else
	{
		echo 'oh no, file move failed';
	}

yj

Posted: Sun Oct 30, 2005 7:54 am
by shiznatix
the manual has a good description on how to upload files

http://ee.php.net/features.file-upload

Posted: Sun Oct 30, 2005 9:58 am
by orangeapple
yes, i have done the check :
it works perfectly in local on my pc but not on the server.
Do the server have writting access privileges ? I can upload in that directory by FTP but not with my script...

Posted: Sun Oct 30, 2005 10:01 am
by Jenk
Post code pls.

Posted: Sun Oct 30, 2005 10:37 am
by orangeapple
here it is :

Code: Select all

$upfiles = '../reports/'.$userfiles_name;
 

 
  if ($userfilesnot !==0)

	 {
   if (is_uploaded_file($userfiles)) 
  {
     
  
  if (!move_uploaded_file($userfiles, $upfiles))
     {
        echo 'Problem: Could not move file to destination directory';
        
	
	exit;
     }
  } 
  else 
  {
    echo 'Problem: Possible file upload attack. Filename: '.$userfiles_name;

    exit;
  }
	  }

Posted: Mon Oct 31, 2005 8:32 am
by orangeapple
SOLVED !
it was the writting permision on the server.