curl-users
Difficulty uploading files via http
Date: Mon, 05 May 2008 13:52:29 +0800
Hello,
I'm new to the more advanced uses of the curl command line tool, such as
scripting to upload files via http.
I'm attempting to upload a file to a form that looks like this:
<form enctype="multipart/form-data" action="kget.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input name="uploaded_file" type="file" />
<input type="submit" name="go" value="Upload" />
</form>
I have tried the methods suggested in this helpful document:
http://curl.haxx.se/docs/httpscripting.html
... but can't seem to get it to work.
My command line looks like this:
curl -F uploaded_file=/home/tpost/desktop/patch -F go=Upload [url]
The url is http://localhost/index.php, where lighttpd is running and
handling the form via php.
Verbose output from curl looks like this:
* About to connect() to localhost port 80
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80
> POST /index.php HTTP/1.1
> User-Agent: curl/7.15.4 (i486-pc-linux-gnu) libcurl/7.15.4
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.3
> Host: localhost
> Accept: */*
> Content-Length: 270
> Expect: 100-continue
> Content-Type: multipart/form-data;
boundary=----------------------------aa8f6f94e571
>
< HTTP/1.1 417 Expectation Failed
< Connection: close
< Date: Mon, 05 May 2008 05:43:07 GMT
< Server: lighttpd/1.4.17
* Closing connection #0
As indicated above, I am using curl 7.15.4 (i486-pc-linux-gnu)
libcurl/7.15.4 on an Ubuntu GNU/Linux (edgy) machine.
The upload works when done manually via browser, I must be doing
something incorrectly with curl. Does anyone see where I'm going wrong?
Thanks in advance to anyone who might be able to help.
Cheers!
--Tim
-- Monkey + Typewriter = Echoreply ( http://echoreply.us )Received on 2008-05-05