Ok. I am getting the following problems with the following script.
Problems:
Warning: move_uploaded_file(uploads): failed to open stream: Is a directory in /home/www/demosthe.allhyper.com/upload.php on line 26
Warning: move_uploaded_file(): Unable to move '/tmp/phpEWSUV9' to 'uploads' in /home/www/demosthe.allhyper.com/upload.php on line 26
Possible file upload attack!
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => tanks.swf
[type] => application/x-shockwave-flash
[tmp_name] => /tmp/phpEWSUV9
[error] => 0
[size] => 425938
)
)
Script:
<?php
//Include the pages needed for this to work and upload place
include ('db.php');
include ('functions.php');
$file = 'uploads';
//Get the needed info
$filename = $post['userfile'];
$des = $post['description'];
$sdate = date("m/d/y g:i:s");
$ip = getip();
//Run some small file checks
$filename = stripslashes($filename);
$filename = str_replace("'","",$filename);
//Upload into the place and add a db entry
$uploadfile = $file . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $file)) {
mysql_query("INSERT INTO `snpvc` (`filename`, `description`, `datetime`, `ip`) VALUES ('$filename','$des','$sdate','$ip')") or die ("MySQL error: " . mysql_error());
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>";
?>
Also I have a folder called uploads and it is set at 777
also can you check the mysql_query because all it is sending is the ip address
Also if you see anyother errors feel free to correct those