jeudi 5 février 2015

Node.js express app fails to redirect from dropzone.js callback


I am trying to add a dropzone.js powered drag and drop upload page to my node.js app which uses express/jade templates to create its pages. The issue I am having is that it seems that there is no way for me to redirect the user from the dropzone callback.


Here is my jade file that creates the dropzone (note the scipts and css are loaded in layout):



extend layout
block content
div(id="dropzone")
form(method="POST" action="upload" class="dropzone" id="my-dropzone")


Here is my very simple callback:



app.post("/upload", function(req, res) {
console.log("UPLOAD POST");
res.redirect("/");
//project.finishUpload(db, req, res);
});


I see the print from the console.log but it never redirects back to the root.


Also, here are my Dropzone options:



Dropzone.options.myDropzone = {
paramName: "file",
maxFilesize: 10,
acceptedFiles: "application/zip"
};


What could I do to cause a redirect from my Dropzone callback?





Aucun commentaire:

Enregistrer un commentaire