hey guys, im having problems uploading my files to a foder on the server.....
heres how my cod looks
html file:
<html>
<head>
<title>test uploade</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="fupload"><br>
<input type="submit" value="upload!">
</form>
</body>
</html>
php file:
<?php
// connect to mysql
$connectionstring = mysql_connect("localhost", "pass", "pass")
or die("could not connect.");
mysql_select_db("p_3",$connectionstring);
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = 'uploadfiles/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
//if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
if (move_uploaded_file($tmpFileName,'uploads/'.$fileName)😉{
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>";
mysql_query($sql, $connectionstring);
mysql_close($connectionstring);
?>
dose any one know how to solve this problem...?