【问题标题】:POST file with bash CGI使用 bash CGI 发布文件
【发布时间】:2015-04-03 10:29:14
【问题描述】:

我正在尝试上传一个文件(在本例中约为 30kb)。我在接收端使用 bash CGI。到目前为止,我只想查看文件的内容。

接收端:

#!/bin/bash
echo "Content-Type: text/plain"
echo

read FILE
echo "$FILE"

发件人表单:

<form class="fileup_form" method="post" action="dds_fileup.cgi" enctype="multipart/form-data">                                          
   <input type="submit" />                                              
   <input type="file" name="file" />                                    
</form> 

目前我得到这个输出:

-----------------------------11054464466732224131260756282

这绝对不是完整的 30kb。

为什么我看不到 POST 文件的全部内容?

【问题讨论】:

标签: html bash post file-upload cgi


【解决方案1】:

'read' 只读取一行。试试这个:

FILE=`cat`
echo $FILE

【讨论】:

  • 使用 FILE="$(cat | dd count=1 bs=1M)" ...或您认为对您有好处的任何大小来限制上传可能会更好。
猜你喜欢
  • 2016-05-15
  • 2014-06-14
  • 1970-01-01
  • 2022-06-11
  • 2012-05-29
  • 1970-01-01
  • 2012-05-30
相关资源
最近更新 更多