Re: A guide to image upload problems
hi all,
i have some questions on php file upload. i have used the following code to upload a file. but it show the error. i have try to set the
safe_mode = on
safe_mode_gid = off
in the php.ini.
Can anyone help me to answer this question?? thanks a lots
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$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>";
?>
ERROR::
Warning: SAFE MODE Restriction in effect. The script whose uid is 522 is not allowed to access /var/www owned by uid 0 in /home/virtual/site20/fst/var/www/html/phptest/uploaded.php on line 10
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => 243.pdf
[type] => application/pdf
[tmp_name] => /tmp/phpptQVTL
[error] => 0
[size] => 104616
)
)
