表单数据的html页面如下
<form name="uploadform" id="uploadform" action="htmlupload.php" enctype="multipart/form-data" method="post">
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<tr>
<td class="tcat">
Upload Files
</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div id="upload" class="panel">
<div style="width:720px" align="left">
<table border="0"><tr>
<td>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
</td>
<td>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
</td>
<td>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
<div><input name="attachment[]" type="file"></div>
</td>
</tr></table>
</div>
<div style="margin-top:6px">
<input value="6ece14a18366a322c347c71cbfe87420" name="uploadcode" type="hidden" />
<input value="upload" name="do" type="hidden" />
<input value="upload" name="uploadbutton" onclick="onClickVerify();" class="button" type="button" accesskey="s" />
<input type="reset" class="button" value="Reset Fields" accesskey="r" />
</div>
</div>
<div class="panel" id="status" style="display:none;width:100%;">
</div>
</td>
</tr>
</table>
</form>
公共网页是http://f7.masaladesi.com/htmlupload.php
我正在尝试使用 curl 命令发布文件并上传,尝试了以下两个命令
curl -b cookie.txt -d "attachment[][email protected]&do=upload" http://f7.masaladesi.com/htmlupload.php
curl -b cookie.txt -F "attachment[][email protected]" http://f7.masaladesi.com/htmlupload.php
但是它不起作用。下面是网页的样子
请给我一个关于如何实现这一点的提示,这是一个选择附件的数组
要添加到@makeiteasy 答案和您之前的问题,这是一个工作示例:
# registration
curl -c cookie.txt \
-d "vb_login_username=username&vb_login_password=password&do=login" \
http://f7.masaladesi.com/login.php
# get an upload code value
uploadcode=$(curl -s -b cookie.txt http://f7.masaladesi.com/htmlupload.php | \
awk 'match($0, /value=\"(.*)\" name="uploadcode"/,arr) { print arr[1] }')
# upload request
curl -b cookie.txt -F "attachment[][email protected]" \
-F "uploadcode=$uploadcode" -F "do=upload" \
http://f7.masaladesi.com/htmlupload.php
这是 :
http://f7.masaladesi.com/htmlupload.php
提取uploadcode
multipart/form-data
内容执行上传请求本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句