how to upload files to aws3 using the jquery plugin hayageek-jquery-upload-file?

0

I have been using the hayageek plugin to upload files to the server and it has worked quite well, but now that I try to upload files to amazon web services I get the following error:

Bucket POST must contain a field called 'key'. "If specified, check the order of the fields.

and I have read that AWS ignores all fields in the application after the file field, so all other fields must appear before the file. This is the code I am using to upload the file:

$("#fileuploader").uploadFile({
        url: "amazon.com/bucket",
        dynamicFormData: function () {
            var data = {
                key: "folder/file",
                acl: "public-read",
                AWSAccessKeyId: "QQWWEERRTTYY",
                policy: "QQQWWWEERRTTYY",
                signature: "qqwweerrttyy"
            };
            return data;
        },
        method: "POST",
        enctype: "multipart/form-data",
        showPreview: true,
        dragDrop: true,
        statusBarWidth: 600,
        dragdropWidth: 600,
        previewHeight: "100px",
        previewWidth: "100px",
        maxFileSize: 100 * 1024,
        dragDropStr: "<span><b>Arrastrar & soltar archivos</b></span>",
        uploadStr: "Cargar",
        abortStr: "Abortar",
        cancelStr: "Cancelar",
        doneStr: "Correcto",
        multiDragErrorStr: "Multiples archivos de arrastrar & soltar no estan permitidos",
        extErrorStr: "No esta permitido. Extenciones permitidas: ",
        duplicateErrorStr: "No esta permitido. Ya existe el archivo.",
        sizeErrorStr: "No esta permitido. Tamaño maximo: ",
        uploadErrorStr: "La carga no esta permitida",
        maxFileCountErrorStr: "No esta permitido. Archivos simultaneos maximos permitidos: ",
        onSuccess: function (files, data, xhr, pd) {
            //files: list of files
            //data: response from server
            //xhr : jquer xhr object
            console.log(xhr);
        },
        onError: function (files, status, errMsg, pd) {
            //files: list of files
            //status: error status
            //errMsg: error message
            console.log(errMsg);
        }
    });

I appreciate any suggestions and help, thank you!

    
asked by Joshue 29.06.2018 в 22:19
source

0 answers