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
ewProject\uploads
In ubuntu : home\public_html
ewProject\uploads[/B]
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 :
[B]
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
[/B]
My php program is
<?php
$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";
}
else
{
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