【发布时间】:2015-04-13 13:27:45
【问题描述】:
我刚接触 haserl,所以我有一个我认为非常基本的问题。我有以下 html 页面:
<form id="upload" method="POST" enctype="multipart/form-data" action"../cgi-bin/test">
<table>
<tr>
<td><input type=file name=uploadcsv id=uploadcsv></td>
<td><input name=import id=import type=submit value=Import></td>
</tr>
</table>
</form>
该 html 文件位于我的 /var/www 文件夹中。
表单显示正确,使用 F12 工具,我可以看到正在发送 POST。 在 Firefox 中 F12 的“参数”选项卡下,我可以看到我使用文件输入控件选择的 csv 文件的内容 但是我在 cgi 文件中的测试逻辑没有被执行。
我在名为 /var/www/cgi-bin/test 的 cgi 脚本中有以下代码:
#!/usr/bin/haserl --shell=lua --upload-target="/uploads"
<%
print('posted')
if FORM.upload then
print ("Status:200")
print ("Content-Type: text/html")
print ("inside the test")
else
print('something went wrong')
end
%>
现在,页面上没有打印任何内容。我也没有在 F12 中看到任何错误。我不认为它正在加载/运行我的 cgi 脚本
到目前为止我所做的尝试:
- 我已将操作标签中的路径更改为“/cgi-bin/test”
- 我已尝试将扩展名“.cgi”附加到操作标记,如“/cgi-bin/test.cgi”。注意:cgi-bin 中的所有脚本都没有扩展名……而且它们工作正常。
- 我将尝试通过将操作设置为“action='#'”将服务器端代码放入 html 中。但我更喜欢最终解决方案没有内联服务器端代码。
任何建议将不胜感激。 谢谢。
【问题讨论】: