Skip to content

Commit 1460d23

Browse files
committed
Support attributes on upload
1 parent c3460d9 commit 1460d23

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ Mediaflow.prototype.upload = function(file, options, callback) {
6565
var formData = new FormData()
6666
formData.append('file', file)
6767
for (var key in options) {
68-
if (Array.isArray(options[key])) {
68+
if (key == 'attributes') {
69+
for (var attrKey in options[key]) {
70+
formData.append('attributes[' + attrKey + ']', options[key][attrKey])
71+
}
72+
}
73+
else if (Array.isArray(options[key])) {
6974
options[key].forEach(function(val) {
7075
formData.append(key + '[]', val)
7176
})

0 commit comments

Comments
 (0)