Jump to content

[SOLVED] Force Download of zip file........


networkthis

Recommended Posts

I am not trying to FORCE the download on peoples computers........ Simply trying to allow users to select files they want to download...place them into a zipfile and download them onto their computer instead of having to select them one by one and download them one by one - wasting most of their day...

 

Here is what I did

<?php 


// My Zip file to Download
$zipfile = "myZip.zip";

header("Pragma: public");

// set expiration time
header("Expires: 0"); 

// browser must download file from server instead of cache
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/zip");
header("Content-Type: application/download");


// Display the save dialog to the user with the filename
header("Content-Disposition: attachment; filename=".basename($zipfile).";");


// Shows a progress bar for the downloading file
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($zipfile));

@readfile($zipfile);
?>

 

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.