Функция PHP, которая загружает пустые файлыPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Функция PHP, которая загружает пустые файлы

Сообщение Anonymous »

У меня есть проблема с функцией, которая должна загрузить. Почему пустые файлы загружаются? Куда я ошибаюсь? Спасибо всем.function downloadAttachmentKb($filesDownload)
{
if (empty($filesDownload)){
return false;
}

set_time_limit(0);
$DownloadDir = "./files/kbfiles/".$filesDownload ;
$DownloadFiles = basename( $filesDownload);
$DovnloadSize = filesize( $DownloadDir);

if (!file_exists($DownloadDir) && !is_writable($DownloadDir)){
die("errore");
}

$MimeFile = mime_content_type($DownloadDir);

if ($MimeFile === false){
header("Content-Type: application/force-download");
}else{
header(header: "Content-Type:".$MimeFile."");
}

if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE")){
header("Content-Disposition: inline ; filename=\"". $DownloadFiles."\"");
} else{
header(header: "Content-Disposition: attachment; filename=\"". $DownloadFiles ."\"");
}

header(header: "Content-Length: ". filesize($DownloadDir));
header("Content-Description: File Transfer");
header("Content-Transfer-Encoding: binary");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: public");
ob_clean();
flush();

echo file_get_contents($DownloadDir);

}
?>


Подробнее здесь: https://stackoverflow.com/questions/797 ... mpty-files
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»