Tag:position filename time representation tran close upd stat val
Public function Download () {$id = input (' id '), $item = Db::name (' Imgsubmit ')->where ([' id ' = = $id])->find (); Db::name (' Imgsubmit ')->where ([' id ' = $id])->update ([' Status ' =>1]); $tt = LTrim ($item [' Zip '], ' uploads/'); $path = config (' Upload_path '). DS. $tt; $arr = explode ('/', $path); $iname = $item [' username ']. ' _ '. $item [' order_no ']; /* $filename = $arr [Count ($arr) -1];*/$filename = $iname. Zip '; $file = fopen ($path, "RB"); if (file_exists ($path)) {$filesize =filesize ($path); header (' Content-description:file Transfer '); Header (" Content-type:application/octet-stream "); Header (' content-transfer-encoding:binary '); Header ("Accept-ranges:bytes"); Header (' expires:0 '); Header (' cache-control:must-revalidate '); Header (' Pragma:public '); Header ("Content-length:". $filesize); Header ("Content-disposition:attachment;filename=". $filename); The following content is quoted by the user's code, because the original source can not find, in this expressed extremely grateful and sorry. Open File $fp = fopen ($path, "RB"); Set pointer position Ob_start (); Fseek ($fp, 0); Unreal Output while (!feof ($fp)) {//Set file maximum execution time set_tIme_limit (0); Print (Fread ($FP, 1024 * 8)); Output file flush (); Output buffer Ob_flush (); } fclose ($FP); Exit ();} Else{echo "file does not exist!!! ";d ie ();}}
PHP Large File Download (Mode 1 does not support the continuation of breakpoints)