Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl post data and file contemporary

Tags:

post

curl

I have tried:

curl -v --http1.0 --data "mac=00:00:00" -F "userfile=@/tmp/02-02-02-02-02-22" http://url_address/getfile.php

but it fails with the following message: Warning: You can only select one HTTP request!

How can I send a mix of data and file by curl? Is it possible or not?

Thank you

like image 483
user3155074 Avatar asked Sep 30 '22 05:09

user3155074


1 Answers

Read up on how -F actually works! You can add any number of data parts and file parts in a multipart formpost that -F makes. -d however makes a "standard" clean post and you cannot mix -d with -F.

You need to first figure out which kind of post you want, then you pick either -d or -F depending on your answer.

like image 192
Daniel Stenberg Avatar answered Oct 04 '22 22:10

Daniel Stenberg