move_uploaded_file fails on yahoo servers, works on godaddy
Posted: Sat Mar 12, 2011 1:10 am
USING PHP 5---->
I have this piece of code that takes a few images off a form, and uploads them to the root folder /images/tour/
It works fine if I upload it to godaddy on another account I have and the images show up as they should in ftp, but no matter what I do on the yahoo server, including granting 777 access to every folder, including the tmp folder, on the server doesn't fix the issue, and the images don't upload.
I have also tried changing the file folder to "/images/tour", putting the script in the root folder and running it as "images/tour".
When I run this script it prints out the root folder, and the temp folder as being "/" for root, and temp as "/tmp"... I'm at a loss...
Here is the code from the form... And I ran the following commented out code and it shows the form is doing it's job correctly:
//echo "<pre>";
//print_r($_FILES);
//echo "</pre>";
if ($_FILES["imgfile2"]["error"] > 0)
{
echo "Return Code: " . $_FILES["imgfile2"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["imgfile2"]["name"] . "<br />";
echo "Type: " . $_FILES["imgfile2"]["type"] . "<br />";
echo "Size: " . ($_FILES["imgfile2"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["imgfile2"]["tmp_name"] . "<br />";
move_uploaded_file($_FILES["imgfile2"]["tmp_name"], "..images/tour/" . $_FILES["imgfile2"]["name"]);
echo "Stored in: " . "..images/tour/" . $_FILES["imgfile2"]["name"];
}
I have this piece of code that takes a few images off a form, and uploads them to the root folder /images/tour/
It works fine if I upload it to godaddy on another account I have and the images show up as they should in ftp, but no matter what I do on the yahoo server, including granting 777 access to every folder, including the tmp folder, on the server doesn't fix the issue, and the images don't upload.
I have also tried changing the file folder to "/images/tour", putting the script in the root folder and running it as "images/tour".
When I run this script it prints out the root folder, and the temp folder as being "/" for root, and temp as "/tmp"... I'm at a loss...
Here is the code from the form... And I ran the following commented out code and it shows the form is doing it's job correctly:
//echo "<pre>";
//print_r($_FILES);
//echo "</pre>";
if ($_FILES["imgfile2"]["error"] > 0)
{
echo "Return Code: " . $_FILES["imgfile2"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["imgfile2"]["name"] . "<br />";
echo "Type: " . $_FILES["imgfile2"]["type"] . "<br />";
echo "Size: " . ($_FILES["imgfile2"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["imgfile2"]["tmp_name"] . "<br />";
move_uploaded_file($_FILES["imgfile2"]["tmp_name"], "..images/tour/" . $_FILES["imgfile2"]["name"]);
echo "Stored in: " . "..images/tour/" . $_FILES["imgfile2"]["name"];
}