From fe561fa106699a0a2e8e20633efed855c33f85c6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Mar 2014 14:17:13 +0100 Subject: First test for download() and delete(). --- www/functions/func_download.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'www/functions/func_download.php') diff --git a/www/functions/func_download.php b/www/functions/func_download.php index 9b3a489..035e5b4 100644 --- a/www/functions/func_download.php +++ b/www/functions/func_download.php @@ -1,7 +1,7 @@ query("SELECT id, owner, share FROM files WHERE parent=" . $folder_id . "); $file_id_ar = $file_id_db->fetchArray(SQLITE3_NUM); @@ -65,15 +65,16 @@ function download_file($db, $file_id){ $uploaddir = "../files/"; $gzip_file = $uploaddir . $file_hash . ".gz"; - $fp = gzopen($gzip_file, 'r') - $uncompressed_file = gzread($fp, filesize($fp)); - header("Content-Type: ".$file_mime); - header("Content-Disposition: attachment; filename=\"".$file_name."\""); - if(!readfile($uncompressed_file)){ + $uncompressed_file = readgzfile($gzip_file); + + if($uncompressed_file){ + header("Content-Type: ".$file_mime); + header("Content-Disposition: attachment; filename=\"".$file_name."\""); + return true; + } else { return false; } - return true; } -- cgit v1.2.3