problem with file to upload to the server : SOLVED

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

problem with file to upload to the server : SOLVED

Post 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 !
Last edited by orangeapple on Mon Oct 31, 2005 8:32 am, edited 1 time in total.
yum-jelly
Forum Commoner
Posts: 98
Joined: Sat Oct 29, 2005 9:16 pm

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

the manual has a good description on how to upload files

http://ee.php.net/features.file-upload
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post 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...
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Post code pls.
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post 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;
  }
	  }
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

SOLVED !
it was the writting permision on the server.
Post Reply