Moderators: macek, egami, gesf

<form enctype='multipart/form-data' action='upload.php' method='post'>
<input type='hidden' name='MAX_FILE_SIZE' value='2000000' />
<input name='uploaded_file' type='file' size='9' />
<input type='submit' value='Upload' />
</form>");
$filename = basename($_FILES['uploaded_file']['name']);
//Сheck that we have a file
if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
//Check if the file's size is 2000Kb or less
if ($_FILES["uploaded_file"]["size"] <= 2000000) {
//Determine the path to which we want to save this file
$newname = dirname(__FILE__).'/upload/'.$filename;
//Check if the file with the same name is already exists on the server
if (!file_exists($newname)) {
//Attempt to move the uploaded file to it's new place
if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
echo "succes"; // you can add "include ("sendme.php");" here
} else {
echo "error";
}
} else {
echo "file already exists";
}
} else {
echo "file too big";
}
} else {
echo "no file";
}
Users browsing this forum: No registered users and 1 guest