From 56b0268d1de0575018fd542b9d1b9b71b88c1057 Mon Sep 17 00:00:00 2001 From: Andreas Fischer <bantu@phpbb.com> Date: Wed, 23 Jun 2010 15:38:24 +0200 Subject: [ticket/9627] Make sure the database record for the filesize is correct. PHPBB3-9627 --- phpBB/includes/functions_download.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB/includes/functions_download.php') diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 6d52e92e7c..606d6eec32 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -157,6 +157,16 @@ function send_file_to_browser($attachment, $upload_dir, $category) trigger_error('UNABLE_TO_DELIVER_FILE'); } + // Make sure the database record for the filesize is correct + if ($size > 0 && $size != $attachment['filesize']) + { + // Update database record + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET filesize = ' . (int) $size . ' + WHERE attach_id = ' . (int) $attachment['attach_id']; + $db->sql_query($sql); + } + // Now the tricky part... let's dance header('Pragma: public'); -- cgit v1.2.1