我要的并不是另存为,就是说不是客户端而是通过帝国的下载页连接,无论是TXT还是JPG文件,都可以直接点击跳出是否保存. 而不是一打开就直接显示在页面了. 就跟DZ论坛的附件下载一样. 在网上找了很就,PHP代码有的,可是就是不懂怎么整合到帝国去.
<?php header("Content-type:application/octet-stream"); header("Accept-Ranges:bytes"); header("Accept-Length:".filesize($file_path)); header("Content-Disposition:attachment;filename=".$file_name); $fp=fopen($file_path,"r"); echo fread($fp,filesize($file_path)); fclose($fp); ?>
|
$fp = fopen($csvfileLoad,"r"); $fsize = filesize($csvfileLoad); $SaveName = str_replace("csv/","",$csvfileLoad); header("Content-type: application/download\r\n"); header("Content-length: $fsize\r\n"); header("Content-disposition-type: attachment\r\n"); header("Content-disposition: filename=$SaveName"); $result = fpassthru($fp);
|