functionIosupload ($str,$dir){if($str!=''){$str= Preg_replace(' #<# ', '', $str); //RemoveIOSuploaded here. -the binary side of the<>parentheses, if not, omit this line of code$str= Preg_replace(' #># ', '', $str);//ditto don't know whyLTrimand theRTrimYou can't use it here, so you can use regular.$str= Preg_replace('/\r|\n/', '', $str);$t= Pack("h*", Preg_replace('# #', '', $str)); //will be -the binary string is converted into binary$name= Mt_rand(0,9999). Time().'. jpg '; //name the file with a timestamp to prevent duplication$time= Date(' y-m-d ', Time());mkdir('./uploads/images/'.$dir.'/'.$time,0777);$file= fopen('./uploads/images/'.$dir.'/'.$time.'/'.$name,"WR");//Open File readable writablefwrite($file,$t); //Write Filefclose($file);//Close File$path= '/images/'.$dir.'/'.$time.'/'.$name;return$path; }}
The above describes the iOS file upload, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.