Php uploads the image file code ,. Php implements the code for uploading image files. the code is very simple. we will not talk nonsense here. we will directly provide the name $ name; $ nameErr of the source code php registry form; if ($ _ SERVER [REQUEST_MET php implements image file upload code,
The code is very simple. here we will not talk nonsense, and we will provide the source code directly.
<? Php // name of the registry ticket $ name = ""; $ nameErr = ""; if ($ _ SERVER ["REQUEST_METHOD"] = "POST ") {if (empty ($ _ POST ['name']) {} else {$ name = $ _ POST ['name']; if (! Preg_match ("/^ [a-zA-Z] * $/", $ name) {$ nameErr = "only letters and spaces are allowed ";} 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 :". $ _ FILES ["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 successful. ";} else {move_uploaded_file ($ _ FILES [" file "] [" tmp_name "]," weiwei /". $ _ FILES ["file"] ["name"]); echo "Stored in :". "weiwei /". $ _ FILES ["file"] ["name"];} echo "uploaded" ;}}?>
Registry ticket
The above is all the content of this article. I hope you will like it.
Pipeline, the code is very simple, here we will not talk nonsense, directly provide the source code php // registry ticket name $ name = ""; $ nameErr = ""; if ($ _ SERVER ["REQUEST_MET...