curl-users
Trouble with a form
Date: Wed, 23 May 2012 12:41:02 +0100 (BST)
I'm having trouble getting curl to submit a form designed to upload a
file. I know basically what I should be doing, but can't seem to get
the details right, the server just presents the same form back as a
response.
The form is as follows (edited down to the basics):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
�"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
� <div>
��� <form name="aspnetForm" method="post" action="upload.aspx" id="aspnetForm" enctype="multipart/form-data">
����� <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
����� <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
����� <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/SOME_SECRET_VALUE" />
����� <script type="text/javascript">
����� //<![CDATA[
����� var theForm = document.forms['aspnetForm'];
����� if (!theForm) {
����� theForm = document.aspnetForm;
����� }
����� function __doPostBack(eventTarget, eventArgument) {
����� if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
������� theForm.__EVENTTARGET.value = eventTarget;
������� theForm.__EVENTARGUMENT.value = eventArgument;
������� theForm.submit();
����� }
����� }
����� //]]>
����� </script>
����� <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/ANOTHER_SECRET_VALUE" />
����� <a id="ctl00_ContentPlaceHolderMain_Save" class="button" href="javascript:__doPostBack('ctl00$ContentPlaceHolderMain$Save','')" name="ctl00_ContentPlaceHolderMain_Save">Save</a>
����� <p>File: <input type="file" name="ctl00$ContentPlaceHolderMain$File" id="ctl00_ContentPlaceHolderMain_File" /></p>
��� </form>
� </div>
</body>
</html>
I tried separate --form arguments for each "input". Is that correct?
Something like:
� curl -k --cookie my-cookies --form ctl00$ContentPlaceHolderMain$File=@file-to-upload --form ...
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-23