Skip to content

Commit 94d3081

Browse files
committed
json format has changed...
see: https://groups.google.com/forum/#!searchin/jquery-fileupload/empty/jquer y-fileupload/0q8PN2v0I28/pOYs76W-VsEJ and: https://github.com/blueimp/jQuery-File-Upload/wiki/Setup format: {"files": [ { "name": "picture1.jpg", "size": 902604, "url": "http:\/\/example.org\/files\/picture1.jpg", "thumbnail_url": "http:\/\/example.org\/files\/thumbnail\/picture1.jpg", "delete_url": "http:\/\/example.org\/files\/picture1.jpg", "delete_type": "DELETE" }, { "name": "picture2.jpg", "size": 841946, "url": "http:\/\/example.org\/files\/picture2.jpg", "thumbnail_url": "http:\/\/example.org\/files\/thumbnail\/picture2.jpg", "delete_url": "http:\/\/example.org\/files\/picture2.jpg", "delete_type": "DELETE" } ]}
1 parent 5add61f commit 94d3081

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/filehandler.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ module.exports = function (middleware, options) {
88
var UploadHandler = require('./uploadhandler')(options);
99
var handler = new UploadHandler(req, res, function (result, redirect) {
1010
if (redirect) {
11-
res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(result))));
11+
files = {files: result};
12+
res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(files))));
1213
} else {
1314
res.set({
1415
'Content-Type': (req.headers.accept || '').indexOf('application/json') !== -1
1516
? 'application/json'
1617
: 'text/plain'
1718
});
18-
res.json(200, result);
19+
files = {files: result};
20+
res.json(200, files);
1921
}
2022
});
2123

0 commit comments

Comments
 (0)