TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,033
  • Total Topics: 21,335
  • Online today: 321
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Large Downloads using TP Download Manager

Started by Lord Anubis, September 23, 2007, 04:34:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lord Anubis

I am having a problem with large downloads (700+ MB), the downloads seem to only go for a maximum time period of 30 mins and will quit, this is downloading not uploading!!! I am FTPing the files to my site, but when downloading them it won't go longer than 30 mins.   Does this have something to do with the TP download manager or is it a configurable value using the PHP.ini file.  I have searched around but haven't found anything that will resolve this issue.

Thanks in advance,

Lord Anubis  ???

G6Cad

That is something you need to contact your host about, they need to change the time execution limit to a higher value
If you have your own server, you need to change the php.ini in apache.

Lord Anubis

Thanks, I will attempt editing the php.ini file again...I couldn't find where that was.

Lord Anubis


G6Cad


Lord Anubis

Well I spoke too soon, seems like it didn't work here is a link to my PHPinfo

http://nextsite.org/phpinfo.php

and here is a link to my php.ini file
http://nextsite.org/php.ini

Also do you know if there is a way to have the TP Download Manager be able to resume downloads, so if the file has to reconnect it will start where it left off instead of restarting from scratch?

Thanks in advance :)

G6Cad

I dont know of any other way then the settings for apache php.ini file, there should be 2 or even three places where you can set the filesize and the time execution for the scripts before they close the connection.

And there is no resuming download or upload of files at this time.

Lord Anubis

Hmmm well I will keep on my search, thanks again for your help :)

Lord Anubis

Would there be an easy way to implement this fread command into the TPdlmanager.template.php

Something like using this type of code to allow resuming of downloads?

function dl_file_resume($file){

   //First, see if the file exists
   if (!is_file($file)) { die("<b>404 File not found!</b>"); }

   //Gather relevent info about file
   $len = filesize($file);
   $filename = basename($file);
   $file_extension = strtolower(substr(strrchr($filename,"."),1));

   //This will set the Content-Type to the appropriate setting for the file
   switch( $file_extension ) {
     case "exe": $ctype="application/octet-stream"; break;
     case "zip": $ctype="application/zip"; break;
     case "rar": $ctype="application/zip"; break;
     case "mp3": $ctype="audio/mpeg"; break;
     case "mpg":$ctype="video/mpeg"; break;
     case "avi": $ctype="video/x-msvideo"; break;

     //The following are for extensions that shouldn't be downloaded (sensitive stuff, like php files)
     case "php":
     case "htm":
     case "html":
     case "txt": die("<b>Cannot be used for ". $file_extension ." files!</b>"); break;

     default: $ctype="application/force-download";
   }

   //Begin writing headers
   header("Pragma: public");
   header("Expires: 0");
   header("Cache-Control:");
   header("Cache-Control: public");
   header("Content-Description: File Transfer");
   
   //Use the switch-generated Content-Type
   header("Content-Type: $ctype");
$filespaces = str_replace("_", " ", $filename);

//if your filename contains underscores, you can replace them with spaces
  $header='Content-Disposition: attachment; filename='.$filespaces.';';
   header($header );
   header("Content-Transfer-Encoding: binary");

  $size=filesize($file);
//check if http_range is sent by browser (or download manager)
   if(isset($_ENV['HTTP_RANGE'])) {
list($a, $range)=explode("=",$_ENV['HTTP_RANGE']);
//if yes, download missing part
str_replace($range, "-", $range);
$size2=$size-1;
header("Content-Range: $range$size2/$size");
$new_length=$size2-$range;
header("Content-Length: $new_length");
//if not, download whole file
} else {
$size2=$size-1;
header("Content-Range: bytes 0-$size2/$size");
header("Content-Length: ".$size2);
}
//open the file
$fp=fopen("$file","r");
//seek to start of missing part
fseek($fp,$range);
//start buffered download
while(!feof($fp))
{
//reset time limit for big files
set_time_limit();
print(fread($fp,1024*8));
flush();
}
fclose($fp);
   
   exit;
     
}

madnexus

Im trying to add a big size file (4.5GB) to the Download Manager (FTP tab, assign file..), but it doesnt show the real size of the file.. just 0kb!!

Is it because the size of the file? The rest of my downloads are working alright, I never had any problem with this.. the bigger file i had was 600MB.

Im using TPv0.9.8 and SMF 1.1.5. Haven't seen any similar problem on the search results...

This website is proudly hosted on Crocweb Cloud Website Hosting.