source: extensions/BatchDownloader/download.php @ 23346

Last change on this file since 23346 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
Line 
1<?php
2define('PHPWG_ROOT_PATH', '../../');
3include(PHPWG_ROOT_PATH.'include/common.inc.php');
4
5check_status(ACCESS_GUEST);
6
7try {
8  $BatchDownloader = new BatchDownloader($_GET['set_id']);
9  $file = $BatchDownloader->getArchivePath();
10 
11  if (!file_exists($file))
12  {
13    throw new Exception('Unable to locate file.');
14  }
15 
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).'');
27
28    header('Cache-Control: no-cache, must-revalidate');
29    header('Pragma: no-cache');
30    header('Expires: 0');
31
32    readlargefile($file);
33  }
34}
35catch (Exception $e)
36{
37  echo $e->getMessage();
38}
39
40exit(0);
41
42?>
Note: See TracBrowser for help on using the repository browser.