mothra
11-01-2005, 04:12 AM
When I attempt to upload files I get the warning:
move_uploaded_file(/home/csadmin/public_html/up/guide.jpg): failed to open stream: Permission denied in /home/csadmin/public_html/bod/upload.php on line 21
I don't pretend to know what I'm doing, but it looks like my file upload needs to be in or under the same directory as the upload script itself? I tested this theory by creating a sub directory there and running the script. I end up with a permissions error at that point, attempting to upload to any other location produces the warning above.
Something else I noticed is I don't see the "csadmin" directory anywhere, I guess this is probably my host directory.
Any help would be appreciated, I thought that I can upload to any directory under the web root (public_html).
Here is the code by the way, copy and pasted from the manual.
if (isset($_POST['submit'])){
$uploaddir = '/home/csadmin/public_html/up/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";
}
move_uploaded_file(/home/csadmin/public_html/up/guide.jpg): failed to open stream: Permission denied in /home/csadmin/public_html/bod/upload.php on line 21
I don't pretend to know what I'm doing, but it looks like my file upload needs to be in or under the same directory as the upload script itself? I tested this theory by creating a sub directory there and running the script. I end up with a permissions error at that point, attempting to upload to any other location produces the warning above.
Something else I noticed is I don't see the "csadmin" directory anywhere, I guess this is probably my host directory.
Any help would be appreciated, I thought that I can upload to any directory under the web root (public_html).
Here is the code by the way, copy and pasted from the manual.
if (isset($_POST['submit'])){
$uploaddir = '/home/csadmin/public_html/up/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";
}