Zip and download in PHP


HOME » PHP

Hi,

I have a folder with full of doc files. Instead of downloading the files one by one, is there any way of zip(rar)-ing them and download in one go with PHP?

Thanks


Related to : Zip and download in PHP
Force download multiple files in a zip archive using PHP
PHP
In this post, I’ll show you how can you download the multiples files in a zip archive using PHP. I’ve made a function in PHP where you’ve to pass the parameters the array of files to be zipped, the second parameter is file name as which zip archive file has to be downloaded and finally the path of files where files to be zipped are located.(assuming that they are all in same folder)
PHP zip corrupt error on download
PHP
I used the following script to limit number of downloads but the downloaded zip files become corrupt.
I altered the code several times but no positive result.
I think there is some problem in parsing my headers or in reading the zip.
This is the code can anyone debug this script
Syntax: [ Download ] [ Hide ]SXBB[id].writeCmd();Syntax: [ Download ] [ Show ]$path ="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
//addslashes($_SERVER['REQUEST_URI']);
$ip = addslashes($_SERVER['REMOTE_ADDR']);
$dl = false;
$sql = sprintf("SELECT UNIX_TIMESTAMP(last_access) last_time
Zip and download in PHP
PHP

Hi,

I have a folder with full of doc files. Instead of downloading the files one by one, is there any way of zip(rar)-ing them and download in one go with PHP?

Thanks


not extract .zip files after download using PHP
PHP

I download my back file with .zip format using this PHP class:

public function download($file)
    {
        $filename = $this->dir . $file;
        $fp = fopen($filename, "rb");
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0,
pre-check=0");
        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-type: application/octet-stream");
        header("Content-length: " . filesize($filename));
        header("Content-disposition: attachment;filename = " . $file .
"");
        header("Content-Transfer-Encoding: binary");
        readfile($filename);
        ob_end_clean();
        die(fpassthru($fp));
        fclose($fp);
    }

this worked and i downloaded .zip file successful. but when i need to extract .zip file using winrar i see this error:

db-backup-2014-11-15_14-18-48-12.zip: The archive is either in unknown format or damaged.

in download :

enter image
description here

in open:

enter image
description here

in extract :

enter image
description here

NOTE: my original file worked and fine extracted using winrar.

i think my problem is CRC32 = 0000000 (in screen one) because in original file is have a true value.

how do fix this problem ?!


Download zip file "Failed network error" (PHP/NGINX)
PHP

I'm getting the following error in my browser (Chrome & Firefox) when I attempt to download a zip file from my live server, https://mysite.com: Failed network error.

Confusingly, using the same code (below) from my live server on my localhost allows me to successfully download this same zip file:

$path=$data['path_new']='uploads/some-path/';
$file_name='test.zip';
$file=$path.$file_name;

header("Content-Disposition: attachment; filename=".$file_name);    
header("Content-Type: application/octet-stream");
readfile($file);

I'm using PHP and NGINX on both my localhost and live server with I believe the same configurations, but obviously something isn't right on my live site. Might someone help?


Download Zip files in PHP
PHP

My wesite has a login feature for users. The users are the users who attended a training session at my training facility. Now the training session is named in numbers , e.g. 2655, 2755 etc. Now i have some particular files or the session kit you can say to be available to the user to download from his login, but only he should be able to download the files of his session. Now i have files in zip. so i have a variable in php name $sessionno which is also the same name of the file which the user has to download. so my following thing does'nt work.

<a href = " <?php header ('location :
$sessionno.zip'); ?> download </a>

so this does'nt work , any ideas ?



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .