Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-17 08:55:01

simsim
Member
Registered: 2006-05-06
Posts: 70

File download size

Hello,

I’ve noticed that when downloading files uploaded via Textpattern, the file size doesn’t seem to be calculated and showed up in the downloading prompt box in any browser. This might be annoying inaccessibility issue, especially when downloading large files.

I resolved the issue by editing publish.php as follows (line 140):

  $filesize = filesize($fullpath); $sent = 0;
        header('Content-Description: File Download');
	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment; filename="' . basename($filename) . '"; size = "'.$filesize.'"');
	// Fix for lame IE 6 pdf bug on servers configured to send cache headers
	header('Cache-Control: private');
	@ini_set("zlib.output_compression", "Off");

As follows:

$filesize = filesize($fullpath); $sent = 0;
	header('Content-Description: File Download');
	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment; filename="' . basename($filename) . '"; size = "'.$filesize.'"');
	// Fix for lame IE 6 pdf bug on servers configured to send cache headers
	header('Cache-Control: private');
	header('Content-Length: ' . filesize($filename));
	@ini_set("zlib.output_compression", "Off");

Adding the file size as part of the Content-Disposition doesn’t seem to work. At least in IE 6 & 7 And Firefox 2 & 3 Beta 5, which are the browsers I’ve noticed this behavior on. So I added a Content-Length directive which perfectly worked.

Last edited by simsim (2008-05-17 08:56:36)

Offline

#2 2008-05-24 17:30:46

simsim
Member
Registered: 2006-05-06
Posts: 70

Re: File download size

Any word on this?

Offline

Board footer

Powered by FluxBB