Quick Tip: Upload Photos to TwitPic with cURL

Dmitri Popov

Productivity Sauce

Oct 08, 2009 GMT
Dmitri Popov

You can upload photos from your machine to TwitPic using the following command:

curl -F "username=[username]" -F "password=[password]" -F "message=message" -F media=@/path/to/photo.jpg http://twitpic.com/api/uploadAndPost

You need the cURL tool installed on your machine for this command to work. Since cURL is available in the software repositories of most mainstream Linux distributions, you can install it using your distro's package manager.

You might wonder why you'd want to upload photos from the command-line when there are many other ways to do that. The answer is automation. For example, you can write a simple Bash script that transfers all new photos from your camera and then uploads them to TwitPic:

gphoto2 --get-all-files --new
for file /home/user/photos/*.jpg; do
curl -F "username=[username]" -F "password=[password]" -F "message=message" -F media=@$file http://twitpic.com/api/uploadAndPost
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More