Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
?>
Не совсем. Как это сделать через скрипт. Скажем так ..download.php?id=1234наврено вам это нужно?
*** скрытое содержание ***PHP:<?php // We'll be outputting a PDF header('Content-type: application/pdf'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="downloaded.pdf"'); // The PDF source is in original.pdf readfile('original.pdf'); ?>
<?php
//.....конект к БД
$result=mysql_query('SELECT link FROM TABLE WHERE id='.$_GET['id']);
$filename=mysql_fetch_array($result)[0];
header('Content-type: '.mime_content_type($filename));
header('Content-Disposition: attachment; filename="'.$filenameю'"');
readfile($filename);
?>
function SaveToClient($filename,$name) {
if(ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']))
$UserBrowser = "Opera";
else if(ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']))
$UserBrowser = "IE";
else
$UserBrowser = '';
$mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream';
header('Content-Type: ' . $mime_type);
header('Content-Encoding: none');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($UserBrowser == 'IE') {
header('Content-Disposition: inline; filename="'.$name.'";');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
else {
header('Content-Disposition: attachment; filename="'.$name.'"');
header('Pragma: no-cache');
}
@readfile($filename);
exit();
}
alexz15, это код download.php? Мне не совсем понятно.
да, это download.phpну, например так:
создаете базу с именами ваших файлов
затем отдаете примерно так:
PHP:<?php //.....конект к БД $result=mysql_query('SELECT link FROM TABLE WHERE id='.$_GET['id']); $filename=mysql_fetch_array($result)[0]; header('Content-type: '.mime_content_type($filename)); header('Content-Disposition: attachment; filename="'.$filenameю'"'); readfile($filename); ?>
SaveToClient('http://site/archiv.zip','archiv.zip');