'**SUMMARY**
Uploads image to imgur or flickr or dropbox. In verbose mode URL values are printed.
**PARAMETERS**
* *api_key* - a string of the API key.
* *api_secret* (required only for flickr and dropbox ) - a string of the API secret.
* *verbose* - If verbose is true all values are printed to the screen
**RETURNS**
if uploading is successful
- Imgur return the original image URL on success and None if it fails.
- Flick returns True on success, else returns False.
- dropbox returns True on success.
**EXAMPLE**
TO upload image to imgur::
>>> img = Image("lenna")
>>> result = img.upload( \'imgur\',"MY_API_KEY1234567890" )
>>> print "Uploaded To: " + result[0]
To upload image to flickr::
>>> img.upload(\'flickr\',\'api_key\',\'api_secret\')
>>> img.invert().upload(\'flickr\') #Once the api keys and secret keys are cached.
To upload image to dropbox::
>>> img.upload(\'dropbox\',\'api_key\',\'api_secret\')
>>> img.invert().upload(\'dropbox\') #Once the api keys and secret keys are cached.
**NOTES**
.. Warning::
This method requires two packages to be installed
- PyCurl
- flickr api.
- dropbox
.. Warning::
You must supply your own API key. See here:
- http://imgur.com/register/api_anon
- http://www.flickr.com/services/api/misc.api_keys.html
- https://www.dropbox.com/developers/start/setup#python'

def upload(self, dest, api_key=None, api_secret=None, verbose=True):

    if (dest == 'imgur'):
        try:
            import pycurl
        except ImportError:
            print 'PycURL    Library    not    installed.'
            return
        response = StringIO()
        c = pycurl.Curl()
        values = [('key', api_key), ('image', (c.FORM_FILE, self.filename))]
        c.setopt(c.URL, 'http://api.imgur.com/2/upload.xml')
        c.setopt(c.HTTPPOST, values)
        c.setopt(c.WRITEFUNCTION, response.write)
        c.perform()
        c.close()
        match = re.search('<hash>(\\w+).*?<deletehash>(\\w+).*?<original>(http://[\\w.]+/[\\w.]+)', response.getvalue(), re.DOTALL)
        if match:
            if verbose:
                print ('Imgur    page:    http://imgur.com/' + match.group(1))
                print ('Original    image:    ' + match.group(3))
                print ('Delete    page:    http://imgur.com/delete/' + match.group(2))
            return [match.group(1), match.group(3), match.group(2)]
        else:
            if verbose:
                print 'The    API    Key    given    is    not    valid'
            return None
    elif (dest == 'flickr'):
        global temp_token
        flickr = None
        try:
            import flickrapi
        except ImportError:
            print 'Flickr    API    is    not    installed.    Please    install    it    from    http://pypi.python.org/pypi/flickrapi'
            return False
        try:
            if (not ((api_key == None) and (api_secret == None))):
                self.flickr = flickrapi.FlickrAPI(api_key, api_secret, cache=True)
                self.flickr.cache = flickrapi.SimpleCache(timeout=3600, max_entries=200)
                self.flickr.authenticate_console('write')
                temp_token = (api_key, api_secret)
            else:
                try:
                    self.flickr = flickrapi.FlickrAPI(temp_token[0], temp_token[1], cache=True)
                    self.flickr.authenticate_console('write')
                except NameError:
                    print 'API    key    and    Secret    key    are    not    set.'
                    return
        except:
            print 'The    API    Key    and    Secret    Key    are    not    valid'
            return False
        if self.filename:
            try:
                self.flickr.upload(self.filename, self.filehandle)
            except:
                print 'Uploading    Failed    !'
                return False
        else:
            tf = self.save(temp=True)
            self.flickr.upload(tf, 'Image')
        return True
    elif (dest == 'dropbox'):
        global dropbox_token
        access_type = 'dropbox'
        try:
            from dropbox import client, rest, session
            import webbrowser
        except ImportError:
            print 'Dropbox    API    is    not    installed.    For    more    info    refer    :    https://www.dropbox.com/developers/start/setup#python    '
            return False
        try:
            if (('dropbox_token' not in globals()) and (api_key != None) and (api_secret != None)):
                sess = session.DropboxSession(api_key, api_secret, access_type)
                request_token = sess.obtain_request_token()
                url = sess.build_authorize_url(request_token)
                webbrowser.open(url)
                print "Please    visit    this    website    and    press    the    'Allow'    button,    then    hit    'Enter'    here."
                raw_input()
                access_token = sess.obtain_access_token(request_token)
                dropbox_token = client.DropboxClient(sess)
            elif dropbox_token:
                pass
            else:
                return None
        except:
            print 'The    API    Key    and    Secret    Key    are    not    valid'
            return False
        if self.filename:
            try:
                f = open(self.filename)
                dropbox_token.put_file(('/SimpleCVImages/' + os.path.split(self.filename)[(-1)]), f)
            except:
                print 'Uploading    Failed    !'
                return False
        else:
            tf = self.save(temp=True)
            f = open(tf)
            dropbox_token.put_file(('/SimpleCVImages/' + 'Image'), f)
            return True
