...

View Full Version : User Upload Problem? Identify Please.



loopsnhoops
04-24-2012, 06:45 AM
Hi,

I have been having problems allowing users to upload their files on my site into my file manager upload/ directory. When I tried I got this:
Upload: circle-unit-304560.gif
Type: image/gif
Size: 12.181640625 Kb
Temp file: /usr/local/pem/vhosts/113282/tmp/phpTeKNv1
Warning: move_uploaded_file(upload/circle-unit-304560.gif): failed to open stream: Permission denied in /usr/local/pem/vhosts/113282/webspace/httpdocs/upload_file.php on line 25 Warning: move_uploaded_file(): Unable to move '/usr/local/pem/vhosts/113282/tmp/phpTeKNv1' to 'upload/circle-unit-304560.gif' in /usr/local/pem/vhosts/113282/webspace/httpdocs/upload_file.php on line 25 Stored in: upload/circle-unit-304560.gif

The code used was

HTML form:


<html lang="en">

<body>

<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

PHP handler:


<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>

Can you identify the problem or offer a solution please. I know this looks like I am asking you to design my website but I can't seem to get past this hurdle.

Thanks, Eric

loopsnhoops
04-24-2012, 07:21 AM
Yeah I double checked :(

loopsnhoops
04-24-2012, 04:34 PM
Haha I don't know... i've never worked with this hosting site before... Would those be the only two problems? Thanks for the replies

SlayerACC
04-25-2012, 03:43 AM
I would think the folder you are moving the file to is not set to be writable.

Check the permissions of the folder to make sure it is set to 777 or 0777

Chmod 777

Thanks SlayerACC.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum