Quick Tip: Upload Photos to TwitPic with cURL

Productivity Sauce
Oct 08, 2009 GMT
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:
#!/bin/sh 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 donecomments powered by Disqus