if(is_readable($filename))
{
$filesize = filesize($filename);
header('Pragma: no-cache');
header("Cache-control: private");
header("Content-type: ".$row['f_type']);
header("Content-Length: $filesize");
header("Content-Disposition: attachment; filename=".$row['f_name']); $fp=fopen($filename,'rb');
while(!feof($fp)) {
print(fread($fp, 4096));
flush();
}
exit;
}
{
$filesize = filesize($filename);
header('Pragma: no-cache');
header("Cache-control: private");
header("Content-type: ".$row['f_type']);
header("Content-Length: $filesize");
header("Content-Disposition: attachment; filename=".$row['f_name']); $fp=fopen($filename,'rb');
while(!feof($fp)) {
print(fread($fp, 4096));
flush();
}
exit;
}
2、你代码中的'f_type'字段是怎么定义的,文件后缀名还是MIME类型,如果是这样的话要用到mime_content_type函数,我弄了几次magic.mime文件,都没有成功。
2、一楼的代码有'f_type'字段,可是我是将文件直接放在目录下的,我不知道怎么获得这个type的信息。
用这方式可以实现你要的功能,只要把你想要的功能加在这段代码之前。
http://xinxin.com/虚拟目录/aa.rar
其实aa.rar放在xinxin.com下或者别的目录
这样,只有点你的“下载”才可以,呵呵至于在ie中打开,只要它装插件了,应该直接打开的,而不是另村为
你那个方法我看过,也试过,还是会存在我说的问题,右键另存为可以,但是直接打开就会提示找不到xxx文件。(下载目录设置的权限是不允许Web用户访问)To xinxin1982(新新):
我不知道你说的那个虚拟目录是什么意思?在哪里配置!