Php Upload function set suffix judgment and random naming, php Upload suffix naming. Php Upload function set suffix judgment and random naming, php Upload suffix naming form. phphtmlheadmetahttp-equivcontent-typecontenttexthtmlcharsetutf-8titleUploadImage php Upload function set suffix judgment and random naming, php Upload suffix naming
Form. php
Upload Image
Upload. php
Check. php
= 36) {$ n = 36 + ceil ($ N-36)/3) * 3; $ captchaResult. = substr ($ captchaSource, $ n, 3);} else {$ captchaResult. = substr ($ captchaSource, $ n, 1) ;}} return $ captchaResult ;}?>
Integrate the three files into one:
= 36) {$ n = 36 + ceil ($ N-36)/3) * 3; $ captchaResult. = substr ($ captchaSource, $ n, 3);} else {$ captchaResult. = substr ($ captchaSource, $ n, 1) ;}return $ captchaResult;} $ type = array ("jpg", "gif", "bmp", "jpeg ", "png"); // determine the type of the uploaded file $ fileext = strtolower (fileext ($ _ FILES ['file'] ['name']); $ uploadfilename = random (8); if (in_array ($ fileext, $ type) {$ filename = explode (". ", $ _ FILES ['file'] ['name']); if (I S_uploaded_file ($ _ FILES ['file'] ['tmp _ name']) {// echo $ _ FILES ['file'] ['tmp _ name']; $ flag = move_uploaded_file ($ _ FILES ['file'] ['tmp _ name'], "/Library/WebServer/Documents/test /". $ uploadfilename. ". ". $ fileext); if ($ flag) {echo "uploaded successfully! ";}Else {echo" Error. ";}echo" Back ";}}?>
Upload Image
Terraform. php html head meta http-equiv = "content-type" content = "text/html" charset = "UTF-8" title Upload Image...