function sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
{
header("Content-Type: {$mimeType}");
$filename = '"' . urlencode($filename) . '"';
header("Content-Disposition: attachment; filename={$filename}");
readfile($serverPath);
exit;
}
{
header("Content-Type: {$mimeType}");
$filename = '"' . urlencode($filename) . '"';
header("Content-Disposition: attachment; filename={$filename}");
readfile($serverPath);
exit;
}
<?php
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=\"llll.jpg\"");?><input type="button" name="Submit7" value="下载到本地硬盘" onclick=location.href="test.php">
怎么出现这样的警告?
能不能给出完整一点的代码
header("Content-Type:text/plain");
header("Accept-Ranges:bytes");
header("Accept-Length:".filesize($filename));
header("Content-Disposition: attachment;filename=".basename($filename));
@$fp = fopen($filename, 'rb');
@flock($fp, 2);
$attachment = @fread($fp, $filesize);
@fclose($fp);
echo $attachment;