Skip to content


Uploading Photos

As of the 1.4 release of the phpFlickr class, you can use the class to upload photos to Flickr. Uploading is pretty simple. Aside from being authenticated (see Authentication section) the very minimum that you'll have to pass is a path to an image file on your php server. You can do either synchronous or asynchronous uploading as follows:

synchronous: $f->sync_upload("photo.jpg");
asynchronous: $f->async_upload("photo.jpg");

The basic difference is that synchronous uploading waits around until Flickr processes the photo and returns a PhotoID. Asynchronous just uploads the picture and gets a "ticketid" that you can use to check on the status of your upload. Asynchronous is much faster, though the photoid won't be instantly available for you. You can read more about asynchronous uploading here:

http://www.flickr.com/services/api/upload.async.html

Both of the functions take the same arguments which are:

Photo: The path of the file to upload.
Title: The title of the photo.
Description: A description of the photo. May contain some limited HTML.
Tags: A space-separated list of tags to apply to the photo.
is_public: Set to 0 for no, 1 for yes.
is_friend: Set to 0 for no, 1 for yes.
is_family: Set to 0 for no, 1 for yes.


8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Tofeeq says

    how to upload multiple images at once

    ReplyReply
  2. Russ says

    How do I create a form to upload a file which I have to browse to on my local machine?

    ReplyReply
    • Dan says

      You have to upload it to your server like any other kind of file. Then you can upload it to Flickr via phpflickr.

      ReplyReply
  3. Russ says

    So what code would be needed? Create a PHP-based form, upload to my own web server then pass through to Flickr with phpFlickr?

    ReplyReply
    • Dan says

      Yep, that would do it!

      ReplyReply
  4. Russ says

    I've tried that, but am getting the following error:

    ReplyReply
  5. Russ says

    rsp stat="fail"
    err code="97" msg="Missing signature"
    /rsp

    ReplyReply
    • Dan says

      You have to authenticate to the Flickr API before you can upload. If you're missing the signature, then you probably haven't authenticated.

      ReplyReply



Some HTML is OK

or, reply to this post via trackback.