I am trying to create a file upload but when I go to upload files, I get this message:
"Warning: Unable to create '/upload': Permission denied in /home/httpd/html/construction/upload.php on line 22"
I've changed the permissions in the /upload folder to nobody but that doesn't help.
In a file called maintain_users.php, I have the following code:
<FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD="POST">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
The next file, upload.php, where the upload is passed to contains the following code:
<?php
/ Userland test for uploaded file. /
function is_uploaded_file($filename) {
if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
$tmp_file = dirname(tempnam('', ''));
}
$tmp_file .= '/' . basename($filename);
/ User might have trailing slash in php.ini... /
return (ereg_replace('/+', '/', $tmp_file) == $filename);
}
if (is_uploaded_file($userfile)) {
copy($userfile, "/upload");
} else {
echo "Possible file upload attack: filename '$userfile'.";
}
?>
Any ideas?
Thanks,
Jamie