cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Require syntax to put/post file to apache tomact server 6.0

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 23 Mar 2011 09:17:02 +0100 (CET)

On Wed, 23 Mar 2011, Dattaprasanna Singbal wrote:

> I am trying to write data from a .txt file to an apache tomcat server 6.0
> residing on my own machine with the following command on Win XP machine from
> command prompt.

Sorry, but this isn't specific enough. You can "write data" a large number of
ways and it really doesn't say what a client should do.

> "\curl-7.21.4-devel-mingw32\bin>curl -d @file1.txt
> http://localhost:8080/file2.txt"
>
> I only end up getting the following message "Warning: Couldn't read data
> from file "file1.txt",

Then that's because there's no file1.txt present in the directory you invoke
curl in. Make -d point out to the _existing_ file.

> For PUT command

> "\curl-7.21.4-devel-mingw32\bin>curl -X -d @file1.txt
> http://localhost:8080/file2.txt"
>
> I get the message
> curl: (6) Could not resolve host: file1.txt; Host not found

-X takes a method keyword. "-X PUT" is probably what you're looking for, but
since there's no file1.txt in that directory it won't help. But note that -X
is a bit of a hackish way to accomplish PUT.

If you want to do PUT the simple way you use -T instead:

    curl -T file1.txt http://localhost:8080/file2.txt

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
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 2011-03-23