Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Sep 042011
 

Post a file to a server using the Curl command

Answer:

You can simulate a HTTP form post, with a file being uploaded to a remote server using the curl command.

curl -F 'photo=@/upload/image.jpg' http://example.com/upload.php

Assume the name of the form element of your upload is called "photo"

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>