I am trying to upload an image file using the code below, and keep getting this response, no matter what I try, can anyone help?
//*************
//response from browser
//*************
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => 11221.jpeg
[type] => image/pjpeg
[tmp_name] => /tmp/phpp57xO0
[error] => 0
[size] => 16492
)
)
//temp echo's
file=/tmp/phpp57xO0
uploaddir=/usr/local/psa/home/vhosts/shirrasoft.com/httpdocs/images/
uploadfile=/usr/local/psa/home/vhosts/shirrasoft.com/httpdocs/images/11221.jpeg
//***********
// myupload.php
//***********
<html>
<body>
<form enctype="multipart/form-data" action="myuploadItem.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="20000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
</body>
</html>
//***********
// myuploadItem.php
//***********
<?php
$uploaddir = '/usr/local/psa/home/vhosts/shirrasoft.com/httpdocs/images/';
$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>";
echo '<br>file='.$FILES['userfile']['tmp_name'];
echo "<br>uploaddir=$uploaddir";
echo "<br>uploadfile=$uploadfile";
?>