cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: how to get "--data " and "-T" value from curl at the same time in a method

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 2 Jun 2011 22:14:47 +0200 (CEST)

On Thu, 2 Jun 2011, zin tun kyaw wrote:

> curl -T C:\Users\a.jpg --data " { "metadata" : "username":"name"} -H
> "Content-Type:application/.." http://localhost:8080/user/folder/a.jpg -v
>
> *But I can't get the "--data" values from data variable.How can i do that?*

You can't. You can only use -T _or_ --data. For a HTTP URL, -T makes a PUT and
--data makes a POST.

But to do PUT and get data from two sources, you can do something like this:

  curl -X PUT --data @file --data "metadata" ...

but that will append a & in there that I don't think you'll like.

-- 
  / 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-06-02