Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:08:09+00:00 2026-06-06T00:08:09+00:00

Occured error(return 403 Forbidden) when upload a Photo without metadata to Picasa web album.

  • 0

Occured error(return 403 Forbidden) when upload a Photo without metadata to Picasa web album.
(Memo: it’susing an OAuth2.0, “userId” is not gmail adress[numerical id])
i don’t know occasion.
anybody please technical support
thanks

public String setdData(Context context, String filePath, String userId, String albumId, String accessToken) {

    // new ImageUploader(context, filePath, filePath).run();
    String url = "https://picasaweb.google.com/data/feed/api/user/" + userId + "/albumid/"
        + albumId;
    HttpClient httpClient = new DefaultHttpClient();
    File file = new File(filePath);
    HttpPost httpPost = new HttpPost(url);
    httpPost.setHeader("GData-Version", "2");
    // httpPost.addHeader("MIME-version", "1.0");
    httpPost.setHeader("Content-type", "image/jpeg");
    httpPost.setHeader("Slug", "plz-to-love-realcat.jpg");
    // httpPost.addHeader("Content-Length", String.valueOf(file.length()));
    httpPost.setHeader("Authorization", "GoogleLogin auth=" + accessToken);
    // httpPost.setHeader("Authorization", "OAuth " + accessToken);

    InputStreamEntity reqEntity;
    org.apache.http.HttpResponse response;

    try {
        reqEntity = new InputStreamEntity(new FileInputStream(file), file.length());

        String CONTENTTYPE_BINARY = "binary/octet-stream";
        reqEntity.setContentType(CONTENTTYPE_BINARY);
        reqEntity.setChunked(true);
        httpPost.setEntity(reqEntity);
        response = httpClient.execute(httpPost);

        Log.d("Picasa Upload", "STATUS CODE : " + response.getStatusLine().getStatusCode());

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:08:12+00:00Added an answer on June 6, 2026 at 12:08 am

    I’m assuming that your accessToken is not null…

    This is my code and it works for me:

    public boolean setdData(Context context, String filePath, String userId, String albumId, String accessToken) {
        boolean success = false;
        Bitmap bitmap = BitmapFactory.decodeFile(filePath);
    
        if (bitmap != null) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                bitmap.compress(Bitmap.CompressFormat.JPEG, 87, baos);
                byte[] data = baos.toByteArray();
    
                ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
                HttpRequestFactory requestFactory = new NetHttpTransport().createRequestFactory();
                InputStreamContent content = new InputStreamContent("image/jpeg", inputStream);
    
                HttpRequest request = requestFactory.buildPostRequest(new genericUrl("https://picasaweb.google.com/data/feed/api/user/"+userId+"/"+albumId+"/default"), content);
                GoogleHeaders headers = new GoogleHeaders();
                String fileName = "Whatever...";
                headers.setSlugFromFileName(fileName);
                headers.setAuthorization("OAuth " + accessToken);
                request.setHeaders(headers);
                request.execute().ignore();
                // Success!
                success = true
            } catch (IOException e) {
            }
        }
        return success;
    }
    

    To make this code work, you will need to include some libraries.
    I used these:

    google-http-client-1.10.2-beta.jar
    google-api-client-1.10.2-beta.jar
    google-oauth-client-1.10.0-beta.jar
    jsr305-1.3.9.jar
    guava-11.0.1.jar

    You can find them here:
    http://code.google.com/p/google-api-java-client/downloads/detail?name=google-api-java-client-1.10.2-beta.zip

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having this error in my j2ee web application. java.sql.SQLException: ORA-00604: error occurred
I would like to return error html text with IsError flag. How could I
$(#submit-button).click(function() { if($.trim($(#email).val()) === ) { $(.error-message-email).show(); } if($.trim($(#password).val()) === ){ $(.error-message-password).show(); } return
I want redirect to error page when exception occured. If the code is not
I usually do something like the example below when I need to return error
An error occurred at line: 9 in the jsp file: /Test1.jsp The method addURL(String,
I got this error An error occurred while parsing EntityName. Line 1, position 61.
Here's the error I get: Description: An error occurred during the compilation of a
2009-06-30 23:36:28,483 ERROR appcfg.py:1272 An unexpected error occurred. Aborting. Traceback (most recent call last):
I'M getting crazied for that ERROR A network-related or instance-specific error occurred while establishing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.