Created
July 8, 2016 20:03
-
-
Save rnicholus/14afe7d05c60ef9cf2020b2d4fa2935b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uploader = new qq.s3.FineUploader({ | |
element: document.getElementById("fineUploader"), | |
request: { | |
endpoint: "http://mybucket.s3.amazonaws.com", | |
accessKey: "MY_AWS_PUBLIC_ACCESS_KEY", | |
params: {category: "foobar"} | |
}, | |
signature: { | |
endpoint: "/s3/signtureHandler" | |
}, | |
uploadSuccess: { | |
endpoint: "/s3/uploadSuccessful" | |
}, | |
iframeSupport: { | |
localBlankPagePath: "success.html" | |
}, | |
objectProperties: { | |
key: function(fileId) { | |
var keyRetrieval = new qq.Promise(), | |
filename = encodeURIComponent(uploader.getName(fileId)), | |
xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState === 4) { | |
var status = xhr.status, | |
key = xhr.responseText; | |
if (status !== 200) { | |
keyRetrieval.failure(); | |
} | |
else { | |
keyRetrieval.success(key); | |
} | |
} | |
} | |
xhr.open("POST", "createKey.html?filename=" + filename); | |
xhr.send(); | |
return keyRetrieval; | |
} | |
}, | |
validation: { | |
allowedExtensions: ["gif", "jpeg", "jpg", "png"], | |
acceptFiles: "image/gif, image/jpeg, image/png", | |
sizeLimit: 5000000, | |
itemLimit: 3 | |
}, | |
retry: { | |
enableAuto: true | |
}, | |
chunking: { | |
enabled: true | |
}, | |
resume: { | |
enabled: true | |
}, | |
deleteFile: { | |
enabled: true, | |
endpoint: "/fileHandler" | |
}, | |
paste: { | |
targetElement: document, | |
promptForName: true | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment