+ Start a Discussion
Bhawani SharmaBhawani Sharma 

Upload file to S3

Hi Experts,

I am trying to upload a file on S3. I have been verified everything couple of times and all looks correct to me, but whenever I am trying to upload file, getting error message saying

<Br/>
responseText =
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidArgument<BR/><Message>POST requires exactly one file upload per request.</Message><BR/><ArgumentValue>0</ArgumentValue><BR/><ArgumentName>file</ArgumentName><BR/><RequestId>3670E4EE52B3BCD5</RequestId><BR/><HostId>b3rOF/9WJHymo1ZENIOlrct/ZusAJ50AnSIP0df3K3+DdEcAFolJDx8qU6DH2N1l</HostId><BR/></Error></Code>

Can someone please help me to findout what I am doing wrong here?

<body>
       
        <div id="s3-fileuploader" class="dropArea"></div>
       
        <script type="text/javascript">

            j$ = jQuery.noConflict();

            //block and unblock UIbased on endpoint url
            function setUI(){
                j$('div.dropArea').unblock();
            }

            $(document).ready(function () {
           
                $('#s3-fileuploader').fineUploader({
               
                    request: {
                        endpoint: "https://{!bucketname}.s3.amazonaws.com",
                        accessKey: "{!key}"
                    },
                    signature: {
                       
                        //always included
                        "expiration": "{!expireStr}",
                       
                        signature : "{!signedPolicy}",
                        policy: "{!policy}",

                        "conditions":
                        [
                            //always included
                            {"acl": "public-read"},
                    
                            //always included
                            {"bucket": "{!bucketname}"},
                    
                            //not included in IE9 and older or Android 2.3.x and older
                            {"Content-Type": "{!ContentType}"},
                    
                            //always included
                            {"key": "{!key}"},
                    
                            //always included
                            {"x-amz-meta-qqfilename": "{!URLENCODE('test.jpg')}"},
                        ]
                    },
                    cors: {
                        expected: true, //all requests are expected to be cross-domain requests
                        sendCredentials: false, //if you want cookies to be sent along with the request
                        allowXdr: true
                    },

                    autoUpload: true,
                    multiple:false,
                    debug: true,
                   
                    text: {
                        uploadButton: '<i class="icon-plus icon-white">Select Files</i> '
                    },    
                    uploadSuccess: {
                        endpoint: "{!redirectURL}"
                    }
                }).on('submit',function(event,id,name){

                    //set endpoint
                    console.log('https://{!bucketname}.s3.amazonaws.com');
                    $(this).fineUploader('setEndpoint','https://{!bucketname}.s3.amazonaws.com');

                });
                setUI();
            });

        </script>
    </body>
Marty C.Marty C.

Hello, Bhawani, your question seems to be about Amazon S3 and not about Salesforce. You may have better luck getting a useful answer by posting your question to the AWS Developer Forums[1].

[1]: AWS Developer Forums (https://forums.aws.amazon.com/index.jspa)

S3-LinkS3-Link
S3- Link is FREE App for Salesforce - Amazon Connector. Its also available on Appexchange. 

 1. Create Amazon S3 file for standard Salesforce attachment through
    trigger.
 2. Upload attachments on Amazon S3 and create reference in Salesforc to
    access those attachments
 3. Attach file related to any Salesforce object on Amazon.
 4. Unlimited free storage.
 5. Auto backup Event logs / inbound email attachments.
 6. Server Side Encryption: AES-256
 7. No file size limit for upload.
 8. File access control capabiliy.
 9. Track file downloads by users.
 10. File exlorer capability.

https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000CW1OXEA1

Here is our email address. Let us know if you have any query.
support@neiloncloud.com

Thanks.
Sonam MeshramSonam Meshram
Hi All,
It is very easy to integrate SFDC with Amazon S3 by using the app named Drag, Drop & Upload Files to Amazon S3 for this am using the same, and its very easy to use and has advanced features like you can delete/view your files from salesforce, and also provide some additional customization.
If you have been using Salesforce for any length of time, you have probably wanted to attach large and multiple files at one time. Now you can! In standard salesforce, you can attach and only upload files up to 25MB size one at a time.

This App provides you the facility to associate multiple files to a record in one go and without any size restriction.

Please have a look : https://sforce.co/34y12sL