I am using PHP version: 4.4.2
Code: Select all
<?php
$flag = $_POST['flag'];
if ($flag != "")
{
$flag = "";
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
$Message = "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
else
{
switch ($_FILES['uploadedfile'] ['error'])
{
case 1:
$Message = '<p> The file is bigger than this PHP installation allows</p>';
break;
case 2:
$Message = '<p> The file is bigger than this form allows</p>';
break;
case 3:
$Message = '<p> Only part of the file was uploaded</p>';
break;
case 4:
$Message = '<p> No file was uploaded</p>';
break;
default:
$Message = 'Error: ' . $_FILES['uploadedfile'] ['error'];
};
}
}
if($flag == "")
{
echo $Message;
echo $Message2;
echo
"
<form enctype=\"multipart/form-data\" action=\"upload.php\" method=\"POST\">
<input type=hidden name=MAX_FILE_SIZE value=1 />
Choose a file to upload: <input name=\"uploadedfile\" type=\"file\" /><br />
<input type=\"submit\" value=\"Upload File\" />
<input type=hidden name=flag value = true>
</form>
";
}
?>Can you see what is wrong with my use of MAX_FILE_SIZE that is allowing the files to be uploaded???
note: I have tried all sorts of uses of double quotes and single quotes and so on so that does not seem to be the issue.
I thank you in advance for your help.