下载cgi perl脚本中的文件
我无法用cgi perl下载该文件。取而代之的是,我把内容打印在网页上,这就是我曾经尝试过的 代码:下载cgi perl脚本中的文件,perl,cgi,download,Perl,Cgi,Download,我无法用cgi perl下载该文件。取而代之的是,我把内容打印在网页上,这就是我曾经尝试过的 代码: use CGI qw /:standard /; use CGI; print "Content-type:text/html\n\n"; my $files_location; my $ID; my @fileholder; $directorypath = "/var/www/cgi-bin/"; $files_location = $directorypath; $ID
use CGI qw /:standard /;
use CGI;
print "Content-type:text/html\n\n";
my $files_location;
my $ID;
my @fileholder;
$directorypath = "/var/www/cgi-bin/";
$files_location = $directorypath;
$ID = 'file.txt';
#$ID = param('ID');
if ($ID eq '') {
print "You must specify a file to download.";
} else {
open(DLFILE, "<$files_location/$ID") || Error('open', 'file');
@fileholder = <DLFILE>;
close (DLFILE) || Error ('close', 'file');
#these are the html codes that forces the browser to open for download
print "Content-Type:application/x-download\n";
print "Content-Disposition:attachment;filename=$ID\n\n";
print @fileholder;
}
Content-Type:application/x-download Content-Disposition:attachment;filename=file.txt ih how are u iam hre
file.txt
你在第四行过得怎么样
print "Content-type:text/html\n\n";
这两个\n
标志着标题的结束,随后将显示内容。摆脱它,再试一次?在第4行,您有:
print "Content-type:text/html\n\n";
这两个\n
标志着标题的结束,随后将显示内容。摆脱它,再试一次?在第4行,您有:
print "Content-type:text/html\n\n";
这两个\n
标志着标题的结束,随后将显示内容。摆脱它,再试一次?在第4行,您有:
print "Content-type:text/html\n\n";
这两个\n
标志着标题的结束,随后将显示内容。摆脱它,然后再试一次?试试评论
print "Content-type:text/html\n\n";
试着评论一下
print "Content-type:text/html\n\n";
试着评论一下
print "Content-type:text/html\n\n";
试着评论一下
print "Content-type:text/html\n\n";
如果循环出现以下情况,则必须将下线从上到内移动:
print "Content-type:text/html\n\n";
到
如果循环出现以下情况,则必须将下线从上到内移动:
print "Content-type:text/html\n\n";
到
如果循环出现以下情况,则必须将下线从上到内移动:
print "Content-type:text/html\n\n";
到
如果循环出现以下情况,则必须将下线从上到内移动:
print "Content-type:text/html\n\n";
到
但我还是得到了同样的答案。没有变化让我更具体一点。请注释掉或完全删除脚本中的第4行。仍然是相同的结果吗?好的,当我将下载代码复制到一个名为download.pl的脚本中,并在原始脚本打印中添加了以下行“
\n”时,我实现了这一点;但我还是得到了同样的答案。没有变化让我更具体一点。请注释掉或完全删除脚本中的第4行。仍然是相同的结果吗?好的,当我将下载代码复制到一个名为download.pl的脚本中,并在原始脚本打印中添加了以下行“
\n”时,我实现了这一点;但我还是得到了同样的答案。没有变化让我更具体一点。请注释掉或完全删除脚本中的第4行。仍然是相同的结果吗?好的,当我将下载代码复制到一个名为download.pl的脚本中,并在原始脚本打印中添加了以下行“
\n”时,我实现了这一点;但我还是得到了同样的答案。没有变化让我更具体一点。请注释掉或完全删除脚本中的第4行。仍然是相同的结果吗?好的,当我将下载代码复制到一个名为download.pl的脚本中,并在原始脚本打印中添加了以下行“
\n”时,我实现了这一点;