Author Topic: need for Resume capability for download  (Read 9158 times)

0 Members and 1 Guest are viewing this topic.

Offline bestfriend

  • Pre-Newbie
  • Posts: 2
    • View Profile
need for Resume capability for download
« on: May 07, 2009, 09:08:12 AM »
hello

there is not Resume download in 4img.
i upload file more 10 mb size.
users need Resume capability for download beacuse on the download for large file it will conect and discounect automatically. therefore it is necessary that program have resume capability.
please help me how i can do it.
i study forum but the codes about this problem not work .

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: need for Resume capability for download
« Reply #1 on: May 07, 2009, 04:14:13 PM »
Hello and welcome to 4images forum.
Edit an image, right click on the image, go to properties and copy location address into clipboard, then paste it into "Download URL" field.
I think this is the only solution at the moment.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bestfriend

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: need for Resume capability for download
« Reply #2 on: May 10, 2009, 09:12:34 AM »
thanks for reply
but it is not for my problem.

let, that we upload a file with 10 mb size in pdf format. in 4img in page of file you can see picture that say pdf file from templates/default/icons/pdf.gif folder , therfore if we want download pdf file must click on download button only .

i click on dwoload button and my " internet download manager" will be open and it start download, but resume capability not be active.

how i can active resume capability on 4 img ?
it seem wiil need change download.php codes.



Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: need for Resume capability for download
« Reply #3 on: May 14, 2009, 07:25:23 AM »
Here is quick fix by using httpdownload class

Step 1
Download class.httpdownload.php file and save as includes/class.httpdownload.php in your 4images gallery.

Step 2
Open downloads.php
Find:
  if (!is_remote_file($file_path) && ($filesize filesize($file_path)) > 0) {
    
header("Content-Length: ".$filesize."\n\n");
  }


Replace with:
/*
  MOD Resume Download
  BEGIN REPLACE
*/
/*
  BEGIN ORIGINAL CODE
  if (!is_remote_file($file_path) && ($filesize = filesize($file_path)) > 0) {
    header("Content-Length: ".$filesize."\n\n");
  }
  END ORIGINAL CODE
*/
  
include_once "includes/class.httpdownload.php";
  
$dlObj = new httpdownload;
  @
ignore_user_abort(true);
  
$dlObj->use_resume true;
  
$dlObj->set_byfile($file_path);
  
$dlObj->filename $file_name;
  
$dlObj->speed 0;

  
$dlObj->download();
  return;
/*
  MOD Resume Download
  END REPLACE
*/



Done.
Please note, this fix will only affect normal download of local files (zip downloads and remote files are not supported)

P.S.
the download class can also restrict download speed by changing
  $dlObj->speed 0;
the number represent Kb/Sec (KiloByte per Second). It will only work on *nix systems or Windows with PHP v5
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline navyseal

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: need for Resume capability for download
« Reply #4 on: July 09, 2009, 09:50:30 AM »
thanx v@no!
« Last Edit: July 09, 2009, 11:30:01 AM by navyseal »

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: need for Resume capability for download
« Reply #5 on: March 08, 2011, 06:49:27 AM »
thank you  :D :D Work 100%