Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem on downloading avi files
    primarykey
    data
    text
    <p>well, i have a php function here, it works fine, but when its going to send 'avi' files to a user, nothing happens. The point is,if user uses any browser to download 'avi' files using this script,there is no problem , but using download managers such as IDM, the script freezes up! so weird!! </p> <p>Thanks</p> <pre><code>function downloadFile($fileLocation,$fileName,$maxSpeed = 300,$doStream=false,$type){ if (connection_status()!=0) return(false); $extension = $type; $mime_type = ""; /* List of File Types */ $fileTypes['swf'] = 'application/x-shockwave-flash'; $fileTypes['pdf'] = 'application/pdf'; $fileTypes['exe'] = 'application/octet-stream'; $fileTypes['zip'] = 'application/zip'; $fileTypes['doc'] = 'application/msword'; $fileTypes['xls'] = 'application/vnd.ms-excel'; $fileTypes['ppt'] = 'application/vnd.ms-powerpoint'; $fileTypes['gif'] = 'image/gif'; $fileTypes['png'] = 'image/png'; $fileTypes['jpeg'] = 'image/jpg'; $fileTypes['jpg'] = 'image/jpg'; $fileTypes['rar'] = 'application/rar'; $fileTypes['ra'] = 'audio/x-pn-realaudio'; $fileTypes['ram'] = 'audio/x-pn-realaudio'; $fileTypes['ogg'] = 'audio/x-pn-realaudio'; $fileTypes['wav'] = 'video/x-msvideo'; $fileTypes['wmv'] = 'video/x-msvideo'; $fileTypes['avi'] = 'application/force-download'; $fileTypes['asf'] = 'video/x-msvideo'; $fileTypes['divx'] = 'video/x-msvideo'; $fileTypes['mp3'] = 'audio/mpeg'; $fileTypes['mp4'] = 'audio/mpeg'; $fileTypes['mpeg'] = 'video/mpeg'; $fileTypes['mpg'] = 'video/mpeg'; $fileTypes['mpe'] = 'video/mpeg'; $fileTypes['mov'] = 'video/quicktime'; $fileTypes['swf'] = 'video/quicktime'; $fileTypes['3gp'] = 'video/quicktime'; $fileTypes['m4a'] = 'video/quicktime'; $fileTypes['aac'] = 'video/quicktime'; $fileTypes['m3u'] = 'video/quicktime'; $contentType = $fileTypes[$extension]; header("Content-Disposition: attachment; filename=\"".$fileName."_[linkloading.ir]._".$extension."\""); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Cache-Control: public"); header("Content-Transfer-Encoding: binary\n"); header('Content-Type: application/force-download'); $contentDisposition = 'attachment'; if($doStream == true){ /* extensions to stream */ $array_listen = array('mp3','m3u','m4a','mid','ogg','ra','ram','wm', 'wav','wma','aac','3gp','avi','mov','mp4','mpeg','mpg','swf','wmv','divx','asf'); if(in_array($extension,$array_listen)){ $contentDisposition = 'inline'; } } header("Accept-Ranges: bytes"); $range = 0; $size = filesize($fileLocation); if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2=$size; $new_length=$size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$size); } if ($size == 0 ) { die('Zero byte file! Aborting download');} set_magic_quotes_runtime(0); $fp=fopen("$fileLocation","rb"); fseek($fp,$range); while(!feof($fp) and (connection_status()==0)) { set_time_limit(0); print(fread($fp,127*$maxSpeed)); flush(); ob_flush(); sleep(1); } fclose($fp); return((connection_status()==0) and !connection_aborted()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload