I need to get a url to redirect to from the server (using Flask) after some files are done uploading so I can redirect to it. I can't use flask for this because it simply is not working, and trying to redirect after POSTing large or multiple files using server side redirects apparently is some kind of browser issue. I'm trying to throw a URL back to the JS, which will do the redirect after it checks all files are uploaded. JS is in a separate file from the HTML, but the url:
of the dropzone is passed to it through a small inline script.
The function in JS I'm trying to use to get the response looks like this:
this.on("complete", function(responseText) {
if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
window.location.href = responseText;
}
});
It does the redirect but instead of the URL that Flask should have been returning (and I know it is) I get the url I was on previously + [object File]
on the end, which obviously Flask throws an error for because it isn't a real URL. The JS uploader I'm using is Dropzone.js, which doesn't use jQuery or anything like that, what am I doing wrong? I'm new to JS and just confused by all this AJAX/JSON/jQuery stuff, is there an easy way to do this?