Permalink
Browse files

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"
  }
]}
  • Loading branch information...
1 parent 5add61f commit 94d3081ae946b97194cfb58a9d43421a4f5e25b0 @andineck andineck committed Feb 4, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/filehandler.js
View
@@ -8,14 +8,16 @@ module.exports = function (middleware, options) {
var UploadHandler = require('./uploadhandler')(options);
var handler = new UploadHandler(req, res, function (result, redirect) {
if (redirect) {
- res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(result))));
+ files = {files: result};
+ res.redirect(redirect.replace(/%s/, encodeURIComponent(JSON.stringify(files))));
} else {
res.set({
'Content-Type': (req.headers.accept || '').indexOf('application/json') !== -1
? 'application/json'
: 'text/plain'
});
- res.json(200, result);
+ files = {files: result};
+ res.json(200, files);
}
});

0 comments on commit 94d3081

Please sign in to comment.