有关文件下载的问题-如何给默认下载的文件加个的扩展名(附下载原程序)
fxjzh 2003-01-10 09:03:01 或者保持名字不变也是可以的,谢谢各位
#!/usr/bin/perl
$imagefile="/var/image/ima.gif";
$f_size=(-s $imagefile);
print "Content-type:application/octet-stream\n";
print "Content-Disposition:attachment;filename=$imagefile\n";
print "Content-Length:$f_size\n\n";
open(IMAGE,"<$imagefile") || die "don't open the file $imagefile\n";
while (read(IMAGE,$buffer,8192))
{print $buffer;
}
close IMAGE;