Php file upload not working in ubuntu

Hi all…

I wrote a simple php program to upload a text file. It worked well in windows. But the same program is not working in ubuntu.

I am using XAMPP server in both windows and ubuntu. In both i created a folder named ‘uploads’ into which the file must be uploaded. I saved the folder in the following location

[B]In windows : XAMPP\htdocs

In ubuntu : home\public_html

In ubuntu i have linked the public_html folder to my htdocs by copying some code in ubuntu forum. All php programs are being executed in ubuntu, except the file uploads. when i execute it in ubuntu it says :

Warning: move_uploaded_file(home/harsh/public_html/newProject/uploads/5.l) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/harsh/public_html/newProject/uploader.php on line 7

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/php7MLLzP’ to ‘home/harsh/public_html/newProject/uploads/5.l’ in /home/harsh/public_html/newProject/uploader.php on line 7

My php program is


       $target_path = "home/harsh/public_html/newProject/uploads/";

       $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

       if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) 

           echo "The file ".  basename( $_FILES['uploadedfile']['name']). 

           " has been uploaded";


            echo "There was an error uploading the file, please try again!";



Please help me to sort out this pboblem. The program is same in windows except the $target_path = “uploads/”

I think the problem is because i am not writing the programs in htdocs but in public_html which is linked to htdocs.

Thank you

Hi harsha2624

did you check write permission to the uploads folder?

what permissions should be checked?? pls tell me

if your are using ftp, right click and file permission option is there ,give write permission 777 for your folder. refer this(

thank you goldensona…
it worked…