Attachaction. class. php
Public function capture () {error_reporting (0); // resolution upload method $ query_string = t ($ _ SERVER ['query _ string']); parse_str ($ query_string, $ query_data); // overwrite the data variable $ log_file = time().'_'.rand(0, 10002.16.'.txt '; $ log_path = RUNTIME_PATH. '/logs /'. date ('y/md/H/'); if (! Is_dir ($ log_path) mkdir ($ log_path, 0777, true); $ file_path = '. /data/uploads /'. date ('y/md/H/'); if (! Is_dir ($ file_path) mkdir ($ file_path, 0777, true); file_put_contents ($ log_path. $ log_file, var_export ($ query_data, true); // button: FileType = img if ($ query_data ['filetype'] = 'img ') {$ file_name = 'capture_'.time().'.jpg ';} // upload the Attachment: FileType = Attachment & FileName=xxx.jpg // you have written it by yourself .. If ($ query_data ['filetype'] = 'attachment') {$ file_name = $ query_data ['filename']; // The name of the file to be overwritten} // process the data stream if ($ stream = fopen ('php: // input', 'R ')) {// post get content // print all the page starting at the offset 10 // echo stream_get_contents ($ stream,-1, 10); $ content = stream_get_contents ($ stream ); file_put_contents ($ file_path. $ file_name, $ content); // This is written .. Fclose ($ stream);} // include 'uploadfile. class. php '; // $ up = new UploadFile (); // $ up-> upload ('. /uploads/'); // $ info = $ up-> getUploadFileInfo (); // echo "<pre>"; // var_dump ($ _ SERVER ); // var_dump ($ info); // echo "</pre>"; // output file echo SITE_URL.ltrim ($ file_path. $ file_name ,'. ');}
Test: