我正在尝试编写shell脚本,它将导出二进制文件。
下面是HTML部分,
<form name="submitForm" action="./exportfile.cgi" method="post" enctype="multipart/form-data">
<input type="submit" id="btnExport" value="Export/>
</form>下面是CGI部分,它只是一个草案,提供更多关于我正在努力实现的目标的信息。
#!/bin/sh
#push some file to IE so it will pop-up a file Save-as pop-up.
echo "Content-type: application/octet-stream"
echo "Content-Length: $contentLength"
echo "Content-Transfer-Encoding: binary"
echo "Content-Disposition: attachment; filename=$filename"
echo ""
echo "$fileContent"有什么办法可以达到上述目的吗?有图书馆吗?有参考文章吗?
感谢你的指导。
发布于 2014-05-09 00:30:47
我用了下面的脚本,
#!/bin/sh
filename="binaryfile.bin"
contentLength=$(wc -c < binaryfile.bin)
echo "Content-type: application/octet-stream"
echo "Content-Length: $contentLength"
echo "Content-Transfer-Encoding: binary"
echo "Content-Disposition: attachment; filename=$filename"
echo ""
cat binaryfile.binhttps://stackoverflow.com/questions/23550745
复制相似问题