" method="post" enctype="multipart/form-data"> " method="post" enctype="multipart/form-data">
PHP で画像をアップロードすると、
<br /><body><br /><form action="<? echo $_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data"><br /><input type="file" name="file" /><br /><input type="submit" value="上传" name='submit' /><br /></form><br /><?PHP<br />if(isset($_POST['submit'])){<br />$file=$_FILES['file'];<br />if($file['name']==null){<br />toalert('你未选择文件!');<br />}else{<br />move_uploaded_file($file['tmp_name'],'F:/'.$file['name']); //将文件上传至 <br />if($_FILES['myfile']['error'] > 0)<br />{<br />echo "错误状态:" . $_FILES['myfile']['error'];<br />}<br />toalert('文件上传成功!');<br />}<br />}<br />function toalert($str){<br />echo "<script language='javascript'>alert('$str');</script>";<br />}<br />?><br /></body><br />