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

  • Home
  • SEARCH
  • 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 8777015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:11:30+00:00 2026-06-13T19:11:30+00:00

I am using third party server which return me following things. 1)url 2)acl 3)policy

  • 0

I am using third party server which return me following things.
1)url
2)acl
3)policy
4)awsAccesskeyID
5)Signature
6)key
I can upload file using following code

final File localFile = new File(localFilePath);

final Part[] parts = { new StringPart("acl", acl),
    new StringPart("policy", policy),
    new StringPart("AWSAccessKeyId", awsAccessKeyId),
    new StringPart("signature", signature),
    new StringPart("key", key, HTTP.UTF_8), 
    new FilePart("file", localFile) };

    final MultipartRequestEntity mpRequestEntity = new MultipartRequestEntity(parts, filePost.getParams());

    filePost.setRequestEntity(mpRequestEntity);
    final HttpClient client = new HttpClient();
    try
    {

       status = client.executeMethod(filePost);
    }

But now I want to use AmazonS3Client using following code but its throwing exception that

10-31 16:21:36.070: INFO/com.amazonaws.request(13882): Received error
response: Status Code: 403, AWS Request ID: 51F7CB27E58F88FD, AWS
Error Code: SignatureDoesNotMatch, AWS Error Message: The request
signature we calculated does not match the signature you provided.
Check your key and signing method., S3 Extended Request ID:
YwNNsWOXg71vXY1VS0apHnHpHp4YVWRJ63xm8C7w36SYg1MNuIykw75YhQco5Lk7

        final AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(awsAccessKeyId, key));


        // Create a list of UploadPartResponse objects. You get one of these
        // for each part upload.
        final List<PartETag> partETags = new ArrayList<PartETag>();

        // Step 1: Initialize.
        final InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(targetURL, key);
        final InitiateMultipartUploadResult initResponse = s3Client.initiateMultipartUpload(initRequest);

        final File file = new File(localFilePath);
        final long contentLength = file.length();
        long partSize = 5242880; // Set part size to 5 MB.

        try
        {
            // Step 2: Upload parts.
            long filePosition = 0;
            for ( int i = 1; filePosition < contentLength; i++ )
            {
                // Last part can be less than 5 MB. Adjust part size.
                partSize = Math.min(partSize, (contentLength - filePosition));

                // Create request to upload a part.
                final UploadPartRequest uploadRequest = new UploadPartRequest().withBucketName(targetURL).withKey(key)
                        .withUploadId(initResponse.getUploadId()).withPartNumber(i).withFileOffset(filePosition)
                        .withFile(file).withPartSize(partSize);

                // Upload part and add response to our list.
                partETags.add(s3Client.uploadPart(uploadRequest).getPartETag());

                filePosition += partSize;
            }

            // Step 3: complete.
            final CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest(targetURL, key,
                    initResponse.getUploadId(), partETags);

            s3Client.completeMultipartUpload(compRequest);
        }
        catch ( final Exception e )
        {
            s3Client.abortMultipartUpload(new AbortMultipartUploadRequest(targetURL, key, initResponse.getUploadId()));
            return false;
        }
        return true;

am I missing something here?

  • 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-13T19:11:31+00:00Added an answer on June 13, 2026 at 7:11 pm

    I found that server sending signature to upload file in one shot. In case of multipart upload multiple signature needed and that will needed at various steps..
    There is no way to upload file in multiple part until server shares the key :(.

    http://dextercoder.blogspot.in/2012/02/multipart-upload-to-amazon-s3-in-three.html

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

Sidebar

Related Questions

I am using some third party library to connect to a server via async
I'm using a third party library which has a blocking function, that is, it
I am using third party server-side controls on my website (Telerik RadControls for ASP
I am working on TCP client server application using c++.third party lib are now
We use a third party library to communicate with their server software, which we
I have a third-party product, a terminal emulator, which provides a DLL that can
We integrate with a third-party service where we can run queries which is right
I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This
When using third-party libraries such as jquery, yui-reset, swfobject and so on, do you
Hi we are using third party tool 'ooyala' for our video in site, Ooyala

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.