How to let anonymous user upload photos?

Topics: Developer Forum
Sep 11, 2007 at 11:42 PM
Hi everyone,

Cool library, this FlickrNet. Reading my photo's works perfect!
But now i want to give my website visitors the ability to upload photos as well.
I have been reading some things about uploading photos to flickr, including the official api manual,
all saying that you first have to redirect your 'user' to make them login and then continue.
But, i don't want all this. I just want a simple upload-input-textbox for everyone, saying 'browse', select a photo, upload and finished!
Is there a way to do this?
I saw the authentication model, explaining the redirect, about having to get that 'Frob'.
If this is necessary, cant this be done by some httprequest, using MY credentials?

Hope someone can help,
thanks in advance.

Tys
Coordinator
Sep 12, 2007 at 8:34 AM
When you've done the authentication for yourself, store the authentication token, and use that in your code.

However be aware that a) all the users photos will end up in your account, and b) the upload will take twice as long and use twice your bandwidth, because they upload the file to your server, then you upload it to Flickr.

Are your users aware that their photos will be stored publicly on Flickr under your username?
Sep 12, 2007 at 10:47 AM
Okay, that sounds good, doing the authentication myself! That's what i need.

But, how to do that code-wise? Because every example i see, is redirecting users to a Flickr web page / pop up, and the continuing.
I also read that a token is only valid for one hour. So storing it somewhere and reusing it, doesn't sound possible. Or is it?

Is it possible for you to post some code?
About how to do a correct authorized upload from my C# codebehind, to my Flickr account, without bugging the user that is actually uploading?
And, yes these users know that they are uploading something to my Flickr account.

Thanks for your help, Tys

Coordinator
Sep 12, 2007 at 12:10 PM
The frob is only valid for one hour. The Token should never expire. Once you have authenticated yourself using whatever code you currently have then write down the authentication token, store it in the code, whatever, then just do:

Flickr f = new Flickr(ApiKey, Secret, Token);
f.Upload(File, etc.....);

Thats it.
Sep 12, 2007 at 4:26 PM
Thanks Sam,
it's all working great now!
Tys
Jan 4, 2008 at 10:12 PM
Tys, (or Sam?),

Would you be willing to post a larger snippet that illustrates how you finally did this?

Thanks, Crile


Jan 4, 2008 at 10:27 PM

Once you have authenticated yourself using whatever code you currently have...


Any chance someone could share a complete implementation of the scenario that Tys described? To wit, "how to do an authorized upload ... without bugging the user?"

Especially the part about getting a valid token without forcing the user to login. We would like the code to login with one fixed set of credentials for one account - all the photos get uploaded to that account.

Thanks
Coordinator
Jan 7, 2008 at 1:24 PM
Download either of the sample applications, either the windows or web one. Both contain working examples of authentication. Just enter your own api key and secret and you're good to go.