[cURL] send a file via HTTP POST

### cURL POST file ###

Solution 1 :

curl -X POST --form "fileupload=@filename.txt" http://your_url.com
You can imagine that you have send a request above in the client side.
And how could I get the file that you have sent in the server side ?
[in PHP] :

Solution 2 :

curl -X POST -d @filename http://your_url.com/
### curl POST data ###
curl -X POST --data "param1=value1&param2=value2" http://your_url.com
[in PHP]:
Similar, to get the value of the parameters that have been sent

Here is the manuel that we can find all the options of cUrl :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s