{% else-1 %}
Иногда нужно создать временый файл и отдать пользователь, чтоб не засорять хост можно отдать файл "на лету" зразу же удалить.

                        
function file_dload($file, $name = 'test.txt', $type = 'application/octet-stream', $del = 1) {   

ob_end_clean();

ob_start();

header('Content-Description: File Transfer');

header('Content-Type: '.$type);

header('Content-Disposition: attachment; filename=' . $name);

header('Content-Transfer-Encoding: binary');

header('Expires: 0');

header('Cache-Control: must-revalidate');

header('Pragma: public');

header('Content-Length: ' . filesize($str));

readfile($file);

if($del)

unlink($file);

flush();

return true;

}
0 22 0
0

Нет фото
CZAR * [мошенник] 21.93
• 7 окт 2014, 13:49


The End, ошибочка *

0

Нет фото
NeaDek(WAT) * [мошенник] 0.57
• 7 окт 2014, 05:08


"зразу"?*