devroom.io/content/posts/2010-06-07-uploading-files-with-curl.md

19 lines
623 B
Markdown
Raw Normal View History

2015-03-26 11:28:08 +00:00
+++
date = "2010-06-07"
title = "Uploading files with Curl"
tags = ["curl", "file upload"]
slug = "uploading-files-with-curl"
+++
I've always trouble uploading files with Curl. Some how the syntax for that command won't stick, so I post it here for future reference.
What I want to do is perform a normal `POST`, including a file and some other variables to a remote server. This is it:
2017-03-20 15:35:19 +00:00
``` shell
curl -i -F name=test -F filedata=@localfile.jpg http://example.org/upload
```
2015-03-26 11:28:08 +00:00
You can add as many `-F` as you want. The `-i` option tells curl to show the response headers as well, which I find useful most of the time.
~