Php implements the source code for file upload ,. Php implements the file upload source code, php implements the file upload source code, more php technology development will go to php Tutorial network, php.662p.com? Php # author: Androidyue # sina @ androidyue # Blog php implements the source code for file upload,
Php realize file upload source code, more php technology development to php Tutorial network, http://php.662p.com
M.jpg [type] => image/jpeg [tmp_name] => C: \ WINDOWS \ Temp \ php1A. tmp [error] => 0 [size] => 44905) $ name = $ upfile ["name"]; // The name $ type = $ upfile ["type"] when transferring a file later; // The type of the uploaded file $ size = $ upfile ["size"]; // size of the uploaded file $ tmp_name = $ upfile ["tmp_name"]; // temporary name of the file uploaded by the user $ error = $ upfile ["error"]; // error message during the upload process // echo $ name; // Determine the file type to determine whether to transfer the file, if yes, set $ OK = 1 to switch ($ type) {case "image/jpg": $ OK = 1; break; case "image/jpeg ": $ OK = 1; break; case "image/gif": $ OK = 1; break; default: $ OK = 0; break ;} // if the file meets the requirements and there is no error during the upload if ($ OK & $ error = '0') {// call the move_uploaded_file () function, file transfer move_uploaded_file ($ tmp_name, 'up /'. $ name); // after the operation is successful, the system prompts echo"