Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Plupload upload directly to Amazon S3?

Tags:

How do I configure Plupload properly so that it will upload files directly to Amazon S3?

like image 205
Vebjorn Ljosa Avatar asked Jan 09 '11 13:01

Vebjorn Ljosa


People also ask

What is S3 direct upload?

Amazon S3 Direct Upload for Web UI is an addon that allows Web UI to make use of S3 Direct Upload to directly upload files to a transient bucket, which will then be moved by the Nuxeo server to a final bucket once the upload is finished.

How do I upload data to Amazon S3?

In the Amazon S3 console, choose the bucket where you want to upload an object, choose Upload, and then choose Add Files. In the file selection dialog box, find the file that you want to upload, choose it, choose Open, and then choose Start Upload. You can watch the progress of the upload in the Transfer pane.

How are objects uploaded to S3 by default?

When you upload a folder, Amazon S3 uploads all of the files and subfolders from the specified folder to your bucket. It then assigns an object key name that is a combination of the uploaded file name and the folder name. For example, if you upload a folder named /images that contains two files, sample1.


1 Answers

  • In addition to condictions for bucket, key, and acl, the policy document must contain rules for name, Filename, and success_action_status. For instance:

        ["starts-with", "$name", ""],
        ["starts-with", "$Filename", ""],
        ["starts-with", "$success_action_status", ""],
    

    Filename is a field that the Flash backend sends, but the HTML5 backend does not.

  • The multipart setting must be True, but that is the default these days.

  • The multipart_params setting must be a dictionary with the following fields:

    • key
    • AWSAccessKeyId
    • acl = 'private'
    • policy
    • signature
    • success_action_status = '201'

    Setting success_action_status to 201 causes S3 to return an XML document with HTTP status code 201. This is necessary to make the flash backend work. (The flash upload stalls when the response is empty and the code is 200 or 204. It results in an I/O error if the response is a redirect.)

  • S3 does not understand chunks, so remove the chunk_size config option.

  • unique_names can be either True or False, both work.
like image 150
Vebjorn Ljosa Avatar answered Sep 29 '22 10:09

Vebjorn Ljosa