Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can only download 1.90mb

Status
Not open for further replies.
Feb 1, 2005
144
US
Weird issue. I dont know if this is a php or apache or maybe mysql issue. When linking files using a mysql query I can not download anything over 1.90mb..the file just stops and says complete at 1.90mb. I can view items in the upload folder and can download items with an absolute link i use an upload script to upload them and I verify that the size is identical as the orginal. 6.5mb.

so far I have change upload size in php.ini, restarted apache, installed the script again from scratch. I have not touched anything in mysql.

Again this is a third party software I am using. It uses the smarty templating engine.

Any ideas would be appreciated.

Here is my code:

Code:
$attachment_dir = './var/attachments';

if( !$lore_system->db->id_exists( $_GET['id'], 'lore_attachments') )
{
	$lore_system->te->assign('error_message', 'invalid_attachment');
	$lore_system->te->display('error_message.tpl');
	exit;
}

$attachment = $lore_db_interface->get_attachment( $_GET['id'] );
if( !file_exists( "$attachment_dir/$attachment[filename]" ) )
{
	echo "File $attachment[filename] not found.";
	exit;
}
$lore_db_interface->increment_attachment_downloads( $_GET['id'] );

//$content_disp = ( eregi('', $_SERVER['HTTP_USER_AGENT']) ) ? 'inline' : 'attachment';
$content_disp = 'attachment';
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header('Content-type: ' . $attachment['filetype']);
header('Content-Disposition:  ' . $content_disp . '; filename="' . $attachment['filename'] . '"');
header('Content-Length: ' . filesize("$attachment_dir/$attachment[filename]") );
header('Accept-Ranges: bytes');
//header("Content-Transfer-Encoding: binary");
@readfile( "$attachment_dir/$attachment[filename]" );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top