Hi All,
Is this possible to keep downloading in the site itself ?
ie) Instead of download popup ask save?open?cancel? then proceed downloading , i have to keep downloading in site itself like buffering?
Hi All,
Is this possible to keep downloading in the site itself ?
ie) Instead of download popup ask save?open?cancel? then proceed downloading , i have to keep downloading in site itself like buffering?
You can force a download using the ‘app/octet’ header:
function forceDownload($filename, $data)
{
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Content-Length: '.strlen($data));
if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
{
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
else
{
header('Pragma: no-cache');
}
echo $data;
}
To ZIP everything up, try something like:
$zip = new ZipArchive();
$zip->open($file, ZIPARCHIVE::CREATE);
$zip->addFromString("some description (e.g. downloaded from site.com)");
$i = 0;
foreach ($files as $file)
{
if (is_file($file))
{
$zip->addFile($file, 'some name '.$i);
$i++;
}
}
$zip->close();
can u give me some sample paths? plz
You may use the php zip extension
http://php.net/manual/en/book.zip.php
or use one of the many zip pbp classes (the class of codeigniter or this )
The zip files will have names with non english names.
Please make some test if so-I had this problem.