This project has moved and is read-only. For the latest updates, please go here.

image upload

Topics: Developer Forum
Aug 10, 2010 at 12:49 PM

I have created an imageuploadfunction.

But when users click upload they get redirected to :

Is it not possible to upload without that the user logs in?

plug of my code:

<font size="2">

string frob = Request.QueryString["frob"];
Flickr flickr = new Flickr(apikey, apiSecret);

</font>Auth auth = flickr.AuthGetToken(frob);
string file = Server.MapPath("xxx/" + Session["filename"].ToString());
string photoId = flickr.UploadPicture(file,"","","", true, true, true);


Aug 10, 2010 at 1:12 PM
I don't know what's happened to your code there, it appears to have corrupted slightly.

You cannot upload without some form of authentication. If you have already obtained a authentication token (from AuthGetToken) then you can store that and reuse later.

There is nothing in the FlickrNet code that actually performs a redirect, so that must be happening in some bit of code you are not showing us.

Aug 10, 2010 at 1:20 PM

the redirect is the "callback url" i think....

All i vant to do is to let users (on my homepage, not authenticated) upload to my oun set....

my entire code is:

page one:

 Flickr flickr = new Flickr(apikey, apiSecret);
            string url = flickr.AuthCalcWebUrl(AuthLevel.Write);

page two:

 string frob = Request.QueryString["frob"];
            Flickr flickr = new Flickr(apikey, apiSecret);
            Auth auth = flickr.AuthGetToken(frob);
            string file = Server.MapPath("SummerUpload/" + Session["filename"].ToString());
            string title = Session["title"].ToString();
            string descripton = Session["description"].ToString();
            string tags = "MiddelfartSparekasse, Sommerfoto, Sommerkonkurrence";

            string photoId = flickr.UploadPicture(file, title, descripton, tags, true, true, true);

            PhotosetCollection sets = flickr.PhotosetsGetList(userid);

            foreach (Photoset s in sets)

                if (s.Title == "Sommerkonkurrence 2010")
                   flickr.PhotosetsAddPhoto(s.PhotosetId, photoId);


Aug 10, 2010 at 1:27 PM
If you need users to upload to YOUR flickr account then you need to save and reuse YOUR authentication token (i.e set Flickr.AuthToken or add as the third parameter to the Flickr() constructor).

You should be aware that Flickr does not allow you to upload photos to your account you do not have full copyright of - so as long as the users of your web site are aware they are giving you full control of the photo then that is fine.

Aug 10, 2010 at 2:05 PM

ok, but how can i get MY token?
Is it not the one created from the frob in the querrystring?

Aug 10, 2010 at 2:39 PM
Your token is produced when you authenticate the API key. So if you followed the above link and logged in then yes, the one gained when using the frob will be your authentication token.