File Upload help
Posted: Sat Sep 24, 2005 4:24 am
Hi all.
Im very new to the world of PHP and found a nice piece of code to allow file uploads, well it would be nice if it worked!
I have a HTML page that allows the user to browse for a file, when the "Upload" button is pressed the information is passed to my test.php page. Unfortunately i keep getting an error warning error:
Can anyone tell me what this means!
This is my php code
Thanks
Im very new to the world of PHP and found a nice piece of code to allow file uploads, well it would be nice if it worked!
I have a HTML page that allows the user to browse for a file, when the "Upload" button is pressed the information is passed to my test.php page. Unfortunately i keep getting an error warning error:
Code: Select all
Warning: move_uploaded_file(/home/fhlinux200/j/jameson-groves.co.uk/user/Yoda.jpg): failed to open stream: Permission denied in /home/fhlinux200/j/jameson-groves.co.uk/user/htdocs/test/test.php on line 9
Warning: move_uploaded_file(): Unable to move '/tmp/phptmOb5R' to '/home/fhlinux200/j/jameson-groves.co.uk/user/Yoda.jpg' in /home/fhlinux200/j/jameson-groves.co.uk/user/htdocs/test/test.php on line 9
Possible file upload attack!This is my php code
Code: Select all
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/home/fhlinux200/j/jameson-groves.co.uk/user/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>