Jump to content

Bypass download file size limit?


AtA

Recommended Posts

Okay, I've searched, and not found anything. I'm sure it's on here somewhere, but I'm kind of on a time limit. I'm helping out a friend with their website. I'm using php to initiate download prompts through a flash file. The code is fine, and everything works perfectly. Only problem is that their band is a sort of an experimental noise group, with tracks ranging between 20 and 40 minutes long. Thus, the file sizes for the mp3s are large. Any over 15mb will just open a blank screen, as opposed to the download prompt. This could be worked around by using zip files, I know, but I was wondering if anyone knew of any way to add a size limit bypass to the php script.

 

This is the code as written :

 

<?php
if(!isset($_GET['file']) || count($_GET)!==1) exit;
$GET_NAME=$_GET['file'];
if(
    !preg_match('/^[a-zA-Z0-9_\-]+\.[a-z0-9]{3}$/',$GET_NAME) ||
    preg_match('/(\.php|index)/',$GET_NAME)
) exit;
if(!file_exists("./files/".$GET_NAME)) die("File not found");
$CONTENT=file_get_contents("./files/".$GET_NAME);
$CONTENT_LEN=strlen($CONTENT);
if(!$CONTENT_LEN) exit;

header("content-type: octet/stream");
header("content-disposition: attachment; filename={$GET_NAME}");
header("content-length: {$CONTENT_LEN}");
header("Cache-Control: max-age=0");

set_time_limit(60*60*5);

echo $CONTENT;
?> 

 

Any way of getting around the size limit without using zip files or decreasing the quality of the mp3s would be greatly appreciated. Thanks, all.

 

Cheers.

Link to comment
https://forums.phpfreaks.com/topic/115125-bypass-download-file-size-limit/
Share on other sites

i dont know what is going on but is error reporting on in your php.ini the time limit could be reaching before it sends out the file download while it is reading the file.  i don't think there is a problem with a download limit.

 

Scott.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.