php upload errors not working :(?

  • Thread starter Thread starter PatrickMS
  • Start date Start date
P

PatrickMS

Guest
every time i keep uploading my test file i get this:

Warning: move_uploaded_file(uploads/test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/PRIVATE/public_html/uploads/upload.php on line 29

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpjbFp94' to 'uploads/test.txt' in /home/PRIVATE/public_html/uploads/upload.php on line 29

and this is the php code:

<?php
$target = "/uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition
if ($uploaded_size > 819200)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
if ($uploaded_type =="txt")
{
echo "No txt file Selected<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

why am i getting this error? i have tryied to set the upload.php to CHmod 777 but still the same problem. any ideas or help?

Thanks,
PatrickMS
 
Back
Top