Welcome, Guest
Username Password: Remember me

Media Download
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Media Download

Media Download 13 May 2010 15:04 #2146

  • Jack L
  • OFFLINE
  • Junior Boarder
  • Posts: 29
Hi Tom,

I just had the time to work on the media download and I found something in the code class.biblestudydownload.php which I think needs to be updated - please correct me if I'm wrong.

I'm talking about the file size - header("Content-Length: ".$size); where $size is coming from the field Filesize when you add a Media. My issue with this is whenever a wrong filesize is entered, download will "not" work properly. What I did is I changed the code to get the filesize directly from our remote server (I think if the file is hosted locally, it will also work):

Instead of using:
$size = $media->size;

$download_file = 'http://'.$server.$path.$filename;

I use:
$filesize = filesize($download_file);

if($filesize > 0) {
header("Content-Length: ".$filesize);
}

After these changes, I don't need to input the filesize anymore and download link works perfectly. I just need to figure out how to display the filesize I'm fetching directly - will report back when I make it work.

I checked v6.2 class.biblestudydownload.php and it seems to be using the same code as v6.1.5.

Thanks,

Jackson
The following user(s) said Thank You: Brian

Re:Media Download 14 May 2010 10:48 #2149

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
What we might do is test to see if your function works - and if not default to the old way. I think there might be issues if curl_fopen is disabled which it is on a lot of servers.
"You shall know the truth and the truth shall set you free." JC
  • Page:
  • 1
Time to create page: 0.51 seconds