下面的代码无法上传文件不知道什么原因,大神帮帮小白把!!!
这是我的代码:
<?php
$maxsize=284800;
echo "here are phps<br/>";
if (!$HTTP_POST_VARS['submit']){
$error=" ";

echo $HTTP_POST_FILES['upload_file'];
if (!is_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'])and !isset($error)){
$error="<b>you must upload a file!</b><br/><br/>";
unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if($HTTP_POST_FILES['upload_file']['size']>$maxsize and !isset($error)){
$error="<b> Error,file must be less than $maxsize bytes.</b><br/><br/>";
unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if ($HTTP_POST_FILES['upload_file']['type']!="image/gif" and  $HTTP_POST_FILES['upload_file']['type']!="image/pjpeg" 
and $HTTP_POST_FILES['upload_file']['type']!="image/jpeg" and !isset($error)){
$error="<b> you may only upload .gif or .jpeg files.</b><br/><br/>";
unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if(!isset($error))
{
move_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'],
"uploads/".$HTTP_POST_FILES['upload_file']['name']);
print "Thank you for your upload.";
exit;
}
else {
echo("$error");
}
?>
<html>
<head></head>
<body>
<form action="<?php echo(htmlspecialchars($_SERVER['PHP_SELF']))?>" method="post" 
enctype="multipart/form-data">
Choose a file to upload:<br/>
<input type="file" name="upload_file" size="80">
<br/>
<input type ="submit" name="submit" value="submit">
</form>
</body>
</html>