Sample usage of uploader.js

In my previous post you saw how I wrote an uploader.js library for managing uploads to imgur.

Now the question is how to use it.

Here is a sample source code from a phonegap+jquery page.

The uploading happens in 2 steps. First, we choose the photo from the photolibrary. uploader.js sets up a callback_func to be invoked whenever the photo gets selected, it returns a 64 bit encoded string of the image. The function on the html side then sets up another function that take cares of the uploading process, setting up a second callback which takes care of any errors that might be raised. Thus it sort of sets up a nested callback.

Sample source code:


Post a Comment