Upload image code
Function Upload ($ file_name, $ path, $ pub, $ size = 204800) {// function Upload ($ file_name, $ path, $ pub) {$ type = implode (", ", $ pub); $ root = $ _ SERVER ['document _ root']; // find the site ROOT path $ image = $ _ FILES [$ file_name]; // the value of the received file field (an array) if ($ image ['name'] = "") {return "" ;}$ upload_path = $ root. $ path; // set the location of the uploaded file $ leixing = strtolower (strrchr ($ image ['name'], ". "); // put the uploaded file name". "All subsequent lowercase letters (get the file extension) $ suijishu = rand (100,999); // Obtain a random number of 100--999; $ server_file = time (). $ suijishu. $ leixing; // Get the Upload file name (timestamp plus random number plus extension) if (in_array ($ leixing, $ pub) {// Determine the extension (set the upload type) /* if ($ image ['size']> $ size) {// compare the size and even size of the uploaded file echo"