18 lines
624 B
Markdown
18 lines
624 B
Markdown
|
---
|
||
|
title: "Uploading files with Curl"
|
||
|
kind: article
|
||
|
slug: uploading-files-with-curl
|
||
|
created_at: 2010-06-07
|
||
|
tags:
|
||
|
- curl
|
||
|
- file upload
|
||
|
---
|
||
|
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:
|
||
|
|
||
|
curl -i -F name=test -F filedata=@localfile.jpg http://example.org/upload
|
||
|
|
||
|
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.
|
||
|
~
|