curl-users
Re: Problem in chunky parser & Problem uploading file
Date: Wed, 28 Jan 2009 20:26:49 -0800
On Thu, Jan 29, 2009 at 01:51:56PM +1000, georg.lippold_at_student.qut.edu.au wrote:
> I am trying to upload files to a web site and wanted to automate the
> process using curl. The website code for a file upload basically
> consists of the following data:
>
> <form method="post" action="" enctype="multipart/form-data">
a multipart/form-data is selected with the -F or --form option.
> To upload a file I wrote the following curl line:
>
> curl -k -i -b ${COOKIES} -c ${COOKIES_NEW} -L \
> -d "command=upload" \
> -d "name=file_1" \
> -d "filename=test.txt" \
> -T "${HOME}/test.txt" \
> -d "submit=submit" \
> "${URL}" > "${OUTFILE}"
>
> However, whenever I try to run curl like that I get the message
>
> curl: (56) Received problem 2 in the chunky parser
Problem 2 is an illegal hex value received from the server. It's almost
definitely a server problem. But it's surprising it's not working, because
the -T option overrides -d and this command ends up doing a PUT, not a POST.
Try replacing all the -d with -F to start. You'll probably also want to
remove the name=file_1 option and replace it with -F file_1=@${HOME}/test.txt
> However, in both cases the file I try to upload is not correctly
> received by the server. I had a look at LiveHTTPHeaders, and Firefox
> sends something like
Note that you can use the --trace-ascii option in curl to get trace output
that you can compare with LifeHTTPHeaders to see where things are going
wrong.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has moved ------------------------------------------------------------------- List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2009-01-29