【问题标题】:trying to post a form to a cgi script试图将表单发布到 cgi 脚本
【发布时间】: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 脚本

到目前为止我所做的尝试:

  1. 我已将操作标签中的路径更改为“/cgi-bin/test”
  2. 我已尝试将扩展名“.cgi”附加到操作标记,如“/cgi-bin/test.cgi”。注意:cgi-bin 中的所有脚本都没有扩展名……而且它们工作正常。
  3. 我将尝试通过将操作设置为“action='#'”将服务器端代码放入 html 中。但我更喜欢最终解决方案没有内联服务器端代码。

任何建议将不胜感激。 谢谢。

【问题讨论】:

    标签: html forms lua


    【解决方案1】:

    我错过了= 登录操作标记。

    【讨论】:

      猜你喜欢
      • 2016-05-15
      • 2020-12-12
      • 2014-01-10
      • 1970-01-01
      • 2022-01-18
      • 2011-09-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多