PHP Implementation upload image file code,
The code is very simple, here we do not much nonsense, directly on the source
<?php//the name of the registration form $name= ""; $nameErr = "", if ($_server["Request_method"]== "POST") {if (Empty ($_post[' name '])) {}else{ $name =$_post[' name ']; if (!preg_match ("/^[a-za-z]*$/", $name)) {$NAMEERR = "only allow letters and spaces"; }else{echo ' name '. $name; }}//File Upload if ((($_files["File" ["type"] = = "Image/gif") | | ($_files["File" ["type"] = = "Image/jpeg") | | ($_files["File" ["type"] = = "Image/pjpeg")) && ($_files["File" ["Size"] < 2000000) {if ($_files["file"] [error "]>0) {echo" error: ". $_fil es["File" ["Error"]. "
"; }else{echo "Upload:". $_files["File" ["Name"]. "
"; echo "type:". $_files["File" ["Type"]. "
"; echo "Size:". $_files["File" ["Size"]. "
"; echo "stored in:". $_files["File" ["Tmp_name"]; }}else{if (file_exists ("weiwei/". $_files["File" ["Name"])) {echo $_files["file" ["Name"]. " Upload succeeded. ";} else{move_uploaded_file ($_files["File" ["Tmp_name"], "weiwei/". $_files["File" ["name"]); echo "Stored in:". " weiwei/". $_files["File" ["Name"]; } echo "Upload success"; }}?>
<title>Registration Form</title>
The above mentioned is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/1035052.html www.bkjia.com true http://www.bkjia.com/PHPjc/1035052.html techarticle PHP Implementation upload image file code, the code is very simple, here we do not much nonsense, directly on the source code php//registration Form name $name= ""; $nameErr = ""; if ($_server["Request_met ...