Script: * File download that supports file download resuming Problem in: * Internet Download manager Problem: * Keeps getting stuck at 99%, constant refresh Misc. Info: * File is actually there, if task is stopped, view hidden files, the file exist and is complete. What is wrong? * I think its something with invalid length being sent, I tried to debug with no luck. Code: $file_loc = '/home/files/'.$file_name_is; $len = @filesize($file_loc); $file_info['swf'] = array($directory_link,'application/x-shockwave-flash'); //*** List keeps going on ****// $filename = $file_name_show; $filename = str_replace(' ','_',$filename); $file_ext = explode('.',$filename); $file_extension = $file_ext[count($file_ext)-1]; $ctype = $file_info[$file_extension][1]; header("Cache-Control:"); header("Cache-Control: public"); header("Content-Type: $ctype"); if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $iefilename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1); header("Content-Disposition: attachment; filename=\"$iefilename\""); } else { header("Content-Disposition: attachment; filename=\"$filename\""); } header("Accept-Ranges: bytes"); if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2 = $len-1; $new_length = $size2-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$len"); } else { $size2=$size-1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$len); } $fp = fopen("$file_loc","rb"); fseek($fp,$range); //start buffered download while(!feof($fp)){ //reset time limit for big files set_time_limit(0); print(fread($fp,1024*$speed)); flush(); ob_flush(); } fclose($fp); exit; PHP: * Will give reps is solved as a sign of appreciation. Thanks,
File upload is not toot much complicated. Read this link azizny this will help you. http://www.plus2net.com/php_tutorial/php_file_upload.php
That is an incomplete Image Upload tutorial. My question was about an file resume download script. Thanks for trying anyway, Peace,
Here's a script that can handle this. I haven't tried it, but I guess it should work. http://www.programmingtalk.com/showthread.php?t=32112 Scroll down to the 4th post or something.
Thanks, but I solved the problem. With minor modifications of this: http://www.webforumz.com/php-forum/20041-anti-leeching-script-problem-on-firefox.htm Everything worked fine. I'll bookmark the url you gave me for future references, looks handy. Peace,