Get the binary raw data from post, select a generated path and image name, and write the data. The idea is very obvious. you can collect the binary raw data from post to your favorite, select a generated path and image name, and then write the image. The idea is obvious.
// Generate an image $ imgDir = 'uploadimg/'; $ filename = "nissangcj ". $ mobile. ". jpg "; // name of the image to be generated $ xmlstr = $ GLOBALS [HTTP_RAW_POST_DATA]; if (empty ($ xmlstr) {$ xmlstr = file_get_contents ('php: // input ');} $ jpg = $ xmlstr; // Obtain the binary original data from post. if (empty ($ jpg) {echo 'nostream '; exit () ;}$ file = fopen (". /". $ imgDir. $ filename, "w"); // open the file and prepare to write fwrite ($ file, $ jpg); // write fclose ($ file); // Close $ filePath = '. /'. $ imgDir. $ filename; // figure If (! File_exists ($ filePath) {echo 'createfail '; exit ();}