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

flickr.UploadPicture could not find file

Topics: Developer Forum
Jun 6, 2007 at 5:29 PM
One problem down, on to the next.

So I finally got my page authenticating properly, but now when I call flickr.UploadPicture like this:

string photoId = flickr.UploadPicture(postfile.FileName, title, description, tags);
(and I have verified that postfile.FileName is the correct local address that I am pulling out of a browse input. C:\test.jpg)

I get a compilation error that C:\test.jpg could not be found, but I know this is bullocks because I can find the file, open it in a browser, or even display it on the exact same page with a <img> tag. I don't know what the deal is or if it is even a problem with Flickr or perhaps my environment... no clue, but any help would be awesome.


Jun 7, 2007 at 9:42 AM
Firstly, small point, I assume you mean a runtime error, and not a compilation error.

Secondly, if you are uploading a file to a web page, then FileName points to the client side filename, i.e. The filename BEFORE you uploaded it - not the filename on the server.

You will instead need to use the InputStream property to get the FileStream to upload direct to Flickr.

Thirdly, be aware that if the user tries to upload a large file to your site it will take twice as long to process, once to upload to your site, and then the same time again to upload to Flickr, plus you are doubling your bandwidth usage. Just something to keep in mind.
Jun 7, 2007 at 5:09 PM
Edited Jun 7, 2007 at 5:33 PM
Perhaps I did not explain clearly, I was not uploading the file to my webserver before uploading it to flickr, I was just giving the flickr.UploadPicture() Method the destination of the file on the remote computer. I didn't realize however that I could just pass it a stream, that makes my life much much easier, thanks. :) Lesson learned, read the intellisyns.

However suddenly I have a new problem that perhaps you can help me with. When I call the flickr.UploadPicture() method I am getting a Method requires write privileges; none granted. (99) error. I realized that I was only calling flickr.AuthCalcWebUrl( but I changed it to flickr.AuthCalcWebUrl(FlickrNet.AuthLevel.Write) and its still throwing the same error after reloading, reauthenticating, and all that.

Thanks for all your help Sam.


Also I found reading other posts a discussion where you said this:

To authenticate a web application you need to redirect to the Flickr web site based on the URL returned by the AuthCalcWebUrl(frob, perms) method.

But it would appear that the AuthCalcWebUrl() Method only takes one argument at least according to my intellisyns (and i tried it just for kicks and it fails) do I have an old version of the API?

Thanks again.