如何使用<a href=""> in perl?

时间:2018-05-22 06:00:30

标签: html perl href

I have a Perl CGI script which invokes HTML form, takes input, and process it.

I want to upload the resultant file to the same localhost server (apache2) but after processing, it generates the resultant file and stops without displaying anything. The resultant file is in a temporary folder ($dir) located in cgi-bin folder.

I tried using the <a href> HTML tag but it is not working.

print "Content-Type: text/html";        
print '<a href="http://localhost/cgi-bin/$dir/test.txt" target="_top">Download your file</a>';

Is there any other way to use <a href> tag in Perl?

1 个答案:

答案 0 :(得分:0)

  

结果文件位于cgi-bin文件夹

中的临时文件夹($ dir)中

不要这样做。

cgi-bin应仅包含CGI程序。

您的服务器几乎可以肯定配置,因此它会尝试在那里执行任何作为CGI程序。

包含数据的文本文件不是程序,尝试将其视为一个程序会导致错误。

将文件保存在外面的 cgi-bin(或者根本不保存它,只是将它从CGI程序直接输出到浏览器)。

相关问题