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.
<a target=_blank href="http://sait.com/pic.jpg"></a>
Е това го знам ама как да започне и да я сваля?talevtehnology каза:Така ще ти я оваря в нова страницаКод:<a target=_blank href="http://sait.com/pic.jpg"></a>
това не ме устройваtalevtehnology каза:Единственния вариянт за който се сещам е снимките да са ти в архив и тогава няш ядове :?:
header('Content-type: image/JPEG');
header('Content-Disposition: attachment; filename="file.jpg";');
readfile(http://site.com/file/);
<?php
$file = 'angry.jpg';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
<?php
$file = $_GET['kartinka'];
?>
<img src="<? echo $file; ?>" />
<?
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
<?php
if ($_POST['getfile'])
{
$file = $_POST['getfile'];
}
$save_as_name = basename($file);
ini_set('session.cache_limiter', '');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
header("Content-Type: application/octet-stream");
header("Content-Disposition: disposition-type=attachment; filename=\"$save_as_name\"");
readfile($file);
?>
Я махни <img src="<? echo $file; ?>" />purko каза:Да, ама не става...Код:<?php $file = $_GET['kartinka']; ?> <img src="<? echo $file; ?>" /> <? if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } ?>
Само показва картинката на страницата.
<?php
$file = $_GET['kartinka'];
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
Е няма ли да е достатъчно само от директорията на картинките да го направя да се сваля?akolevutd каза:Внимавайте с този начин на download, че може да ви download-нат и php файловете.
Също така, използвайте base64_encode например, за да укажете пътя до снимката, ако не искате да имате странни прехвърляния и грешки.
<?php
// Сваляне на файлове
$file = $_GET['kartinka'];
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header( "Content-Disposition: attachment; filename=".basename($file));
header( "Content-Description: File Transfer");
@readfile($file);
?>
<?php
$file = $_GET["kartinka"];
$extensions = array("jpg");//позволени типове
$extension_file = end(explode(".",$file));
$extension_file = strtolower($extension_file);
if(!in_array($extension_file,$extensions)){
echo "Непозволен тип файл";
exit;
}
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/jpg');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>