Getting HTML URL of the photo I just uploaded?

Dec 5, 2010 at 12:14 PM

First of all, I would like to say thank you to Sam for making this great library.

Now a potentially dummy question - after calling the UploadPictureAsync() method, is there any way I can retrieve the HTML URL of the uploaded image (i.e. www.flickr.com/myimage.jpg )?

Thanks

Andrew

Coordinator
Dec 5, 2010 at 5:41 PM

The callback method to UploadPictureAsync is passed the photo ID (FlickrResult.Result), from this you need to call PhotosGetInfo or PhotosGetSizes to get the Urls for the image.

Sam

Dec 5, 2010 at 8:06 PM

thank you thank you :)

May 24, 2012 at 12:13 PM

i am developing ASP.NET website with C# code, myself use that below code is that correct

string photoUploaded = flickr.UploadPicture(file.InputStream, file.FileName.ToString(), "nature", "BMI", "funny", true, true, true, ContentTypeSearch.PhotosOnly, SafetyLevel.None, HiddenFromSearch.None, r =>
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        if (r.HasError)
                        {
                            MessageBox.Show(r.Error.Message);
                        }
                        else
                        {
                            UploadProgressBar.Visibility = System.Windows.Visibility.Collapsed;
                            MessageBox.Show("Uploaded Sucessfully");
                            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }
                    });
                });

 

if i correct means, i have error for below one for upload method us as a uploadPictureAsync

CS1502: The best overloaded method match for 'FlickrNet.Flickr.UploadPictureAsync(System.IO.Stream, string, string, string, string, bool, bool, bool, FlickrNet.ContentType, FlickrNet.SafetyLevel, FlickrNet.HiddenFromSearch, System.Action<FlickrNet.FlickrResult<string>>)' has some invalid arguments

 

 

this is code
 
string photoUploaded = flickr.UploadPictureAsync(file.InputStream.Position,
"Fine", "nature", "BMI", "funny", true, true, true, ContentTypeSearch.PhotosOnly,
SafetyLevel.Safe, HiddenFromSearch.None,function());


what should i add in action callback
string photoUploaded = flickr.UploadPictureAsync(file.InputStream.Position, "Fine",
"nature", "BMI", "funny", true, true, true, ContentTypeSearch.PhotosOnly,
SafetyLevel.Safe, HiddenFromSearch.None,Action<FlickrNet.FlickrResult<>> );

Coordinator
May 24, 2012 at 3:35 PM

I'm confused, because you appear to have posted a number of different bits of code, none of which match.

UploadPictureAsync doesn't return anything, so assigning it so it to a string is wrong. But then if you are doing this in a asp.net web app you probably shouldn't be using the Async method, as that is designed for windows phone, silverlight etc, not ASP.Net.

Secondly, you are passing in a ContentTypeSearch enum, when the error is saying it should be a ContentType enum.

In another of your code snippets you are passing in InputSTream.Position, which is a long integer, and not a Stream object, so that's obviously wrong.

To upload a file do something like this:

string photoUploaded = flickr.UploadPicture(file.InputStream, "Fine", "nature", "BMI", "funny", true, true, true, ContentType.Photo, SafetyLevel.Safe, HiddenFromSearch.None);