source: extensions/BatchDownloader/download.php @ 23343

Last change on this file since 23343 was 23291, checked in by mistic100, 11 years ago

fininalize download page
handle no-image files
correct link error when zips number changes

File size: 982 bytes
RevLine 
[16379]1<?php
2define('PHPWG_ROOT_PATH', '../../');
3include(PHPWG_ROOT_PATH.'include/common.inc.php');
4
[16948]5check_status(ACCESS_GUEST);
[16379]6
[16609]7try {
8  $BatchDownloader = new BatchDownloader($_GET['set_id']);
9  $file = $BatchDownloader->getArchivePath();
[23167]10 
[23291]11  if (!file_exists($file))
12  {
13    throw new Exception('Unable to locate file.');
14  }
15 
[23167]16  if (isset($conf['batch_download_direct']) and $conf['batch_download_direct'])
17  {
18    header('Location: '.$file);
19  }
20  else
21  {
22    header('Content-Type: application/force-download; name="'.basename($file).'"');
23    header('Content-Disposition: attachment; filename="'.basename($file).'"');
24    header('Content-Description: File Transfer');
25    header('Content-Transfer-Encoding: binary');
26    header('Content-Length: '.filesize($file).'');
[16379]27
[23167]28    header('Cache-Control: no-cache, must-revalidate');
29    header('Pragma: no-cache');
30    header('Expires: 0');
[16379]31
[23167]32    readlargefile($file);
33  }
[16609]34}
35catch (Exception $e)
36{
37  echo $e->getMessage();
38}
[18973]39
[16379]40exit(0);
41
[23167]42?>
Note: See TracBrowser for help on using the repository browser.