Hi,
we are trying to upload a simple text file over the server using curl, although it seems very simple task it has eat up our brain completely.
same thing we are able to accomplish in HTML within few second and using few line of code.
here is the sample HTML code : working fine uploading file successfully
here is the similar curl code: getting exception {Missing file}
We tried all the option available with HttpForm
like httpform.add-file or HttpFormData example of curl documentation.
but all the effort are in vain.
any help on this would be great help....thanks in advance..:)
thanks
Akash Jain
we are trying to upload a simple text file over the server using curl, although it seems very simple task it has eat up our brain completely.
same thing we are able to accomplish in HTML within few second and using few line of code.
here is the sample HTML code : working fine uploading file successfully
<HTML>
<HEAD><TITLE>Upload Form</TITLE></HEAD>
<BODY>
<H3>File Uploading Example</H3>
<FORM METHOD="POST" ENCTYPE="multipart/form-data" action="http://www.xyz.com/import.xml?sid=xxxxxxxxxxxxxxxxxxxxxxx">
<P> Text group <BR>
<INPUT TYPE="TEXT" NAME="format" VALUE="csv" SIZE="20"> <BR>
<INPUT TYPE="TEXT" NAME="category" VALUE="Unfiled" SIZE="20"> <BR>
<INPUT TYPE="TEXT" NAME="charset" VALUE="UTF-8" SIZE="20"> <BR>
<P> File list <BR>
<INPUT TYPE="FILE" NAME="file"> <BR>
<P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Reset">
</FORM>
<P> Warning! <BR>
This example ignores the HTTP request if the length of the posted data
exceeds 400,000 bytes.
</BODY>
</HTML>
here is the similar curl code: getting exception {Missing file}
{curl 7.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{applet manifest = "manifest.mcurl",
{compiler-directives careful? = true}
}
{let hform:HttpForm = {new HttpForm,
{url "http://www.xyz.com/import.xml?sid=xxxxxxxxxxxxxxxxxxx"} ,
method = HttpRequestMethod.post,
encoding = HttpFormData.multipart-mime-type,
target = "_self",
default-character-encoding = CharEncoding.utf8,
{CommandButton label = "import",
{on Action at c:CommandButton do
{c.form.submit}
}
}
}
}
{hform.add-string-param "format","csv"}
{hform.add-string-param "category","Unfiled"}
{hform.add-string-param "charset","UTF-8"}
{hform.add-file "file",
{url "file:///d:/test.csv"}
}
{value hform}
We tried all the option available with HttpForm
like httpform.add-file or HttpFormData example of curl documentation.
but all the effort are in vain.
any help on this would be great help....thanks in advance..:)
thanks
Akash Jain