5 messages in com.googlegroups.google-picasa-data-apiRe: Error "Not an image" when posting...
FromSent OnAttachments
Henrik17 Oct 2007 05:36 
Sven17 Oct 2007 08:55 
Sven17 Oct 2007 09:16 
Ryan Boyd (Google)17 Oct 2007 09:29 
Henrik17 Oct 2007 12:23 
Subject:Re: Error "Not an image" when posting image using Java ME HttpConnection
From:Henrik (henr@gmail.com)
Date:10/17/2007 12:23:12 PM
List:com.googlegroups.google-picasa-data-api

Sven, Ryan,

Thanks a lot for your help. After removing the base64 encoding and sending the image data as raw binary data it works just fine.

I just noticed that the "Post a new photo" example in the API docs which I more or less copied actually does say "_binary_ image data goes here". I just wish I had read it a bit more thorough! :-)

Thanks /Henrik

On 17 Okt, 18:30, "Ryan Boyd (Google)" <api.@google.com> wrote:

Hi Henrik,

I filed this in our bug
tracker:http://code.google.com/p/gdata-issues/issues/detail?id=151

Please star the issue to be notified of changes and to express your support for resolving this issue.

Thanks!

-Ryan

On 10/17/07, Sven <s.@google.com> wrote:

Hi Henrik,

Another quick update, I looked through our code and we do indeed have a bug in our processing of multipart-related with Content-Transfer-Encoding set to base64. For now the workaround is to send the data in binary and not in base64. We'll let you know when we have fixed our parsing code to correctly handle this encoding. Thanks!

-Sven

On 17/10/2007, Sven < s.@google.com> wrote:

Hi Henrik,

If you don't include a Content-Transfer-Encoding, we will try to parse your text as an image, which is why you're getting the " Not an image" error. I'm not sure why it doesn't work when you set the Content-Transfer-Encoding, however, as that should correctly tell us to parse the image as base64 data. Can you send me an example of what the request looks like when you try to set that header on the image part?

Another solution is to not send base64 data at all, but just send the image bytes directly in the body of the second part. That will also keep the request size down and help speed up the upload.

Let me know if you need any more assistance.

-Sven

On 17/10/2007, Henrik < henr@gmail.com> wrote:

Hi,

I'm trying to write a simple Java ME application that uploads a photo to a Picasa Web album. The problem is that I keep getting the error response "500 Internal Server Error: (12) Not an image".

I'm making a HTTP POST with multipart/related data and the image encoded in base64 as described in the API, but no matter which image data I supply I keep getting the same error message.

My post has the following headers:

Content-Type: multipart/related; boundary="END_OF_PART" Content-Length: 6687 MIME-version: 1.0 Authorization: GoogleLogin auth=[[my auth]]

And the following body:

Media multipart posting --END_OF_PART Content-Type: application/atom+xml

<entry xmlns='http://www.w3.org/2005/Atom' <http://www.w3.org/2005/Atom%27>> <title>test.jpg</title> <summary>Some text</summary> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> </entry> --END_OF_PART Content-Type: image/jpeg

/9j/4AAQSkZJRgABAQEAYABgAAD/ 2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a [[more base64 data]] ACiiigAooooA/9k= --END_OF_PART--

My Base64 encoded image data is newline wrapped so that every line is 76 characters. I have also tried not line wrapping the data. I have tried several different images (ranging in size from 2 kB to 20 kB) but keep getting the same error response. Have also tried setting the Content-Transfer-Encoding header to base64, but it didn't help either.

Any ideas? Could this be related to the previously described problem with chunked HTTP data?