Insufficient permissions. Method requires write privileges; read granted. (99)

Topics: Developer Forum, User Forum
Nov 27, 2007 at 7:13 PM
I'm trying to let visitors to my website upload photos to my flickr account without signing in. But I get the error: "Insufficient permissions. Method requires write privileges; read granted. (99)" when the code gets to the upload section. Here's my code:

Dim f As New Flickr(ApiKey, Secret, Token)

Dim title As String = "Test Photo"
Dim description As String = "This is the description of the photo"
Dim tags As String = "tag1,tag2,tag3"
f.UploadPicture(Server.MapPath("data\" + FileUpload1.FileName), title, description, tags)

Is there a setting that I'm missing somewhere to grant write permission?

Thanks.
Coordinator
Nov 28, 2007 at 8:54 AM
When you created the Token, or rather the call to CalcWebUrl(AuthPerm) what permissions did you ask for?

Also, if you have changed the line above at any point from read only to write then you might need to un-authenticate your application on Flickr first, as there might be a bug with the permissions not escalating correctly.
Nov 28, 2007 at 5:17 PM
Sam,

Thanks that was the problem. I'll detail the solution below for future users.

I downloaded the sample website from the Examples page and placed the VB versions on my server.

I changed one line in the DefaultVB.aspx.vb file from:

Dim auth_url As String = flickr.AuthCalcWebUrl(FlickrNet.AuthLevel.Read)

to

Dim auth_url As String = flickr.AuthCalcWebUrl(FlickrNet.AuthLevel.Write)

Then I changed the Callback URL on my Flickr API Key to point to the AuthVB.aspx file.

I added one line of code to the AuthVB.aspx.vb file:

Label1.Text &= "Token: " & auth.Token

Then when I ran the web page, starting at Default.aspx, the end result was a token, with right permissions being created for me.

I copied that token into the upload page that I was creating and everything worked smoothly

Dim f As New Flickr(ApiKey, Secret, Token)
Dim title As String = "Test Photo"
Dim description As String = "This is the description of the photo"
Dim tags As String = "tag1,tag2,tag3"
f.UploadPicture(Server.MapPath("data\" + FileUpload1.FileName), title, description, tags)