How to setup for jQuery-File-Upload? How to implement the upload handler? How to setup for jQuery-File-Upload? How to implement the upload handler? flask flask

How to setup for jQuery-File-Upload? How to implement the upload handler?


Maybe one or two hints:

  1. The upload handler is simply a URL endpoint that the jQuery File Upload can send files to - it needs to be able to handle incoming HTTP requests.

    @app.route("/uploads", methods=["GET", "POST"])def upload_handler():    # Handle the upload here    pass
  2. You don't need to upload the entire folder - only the CSS and JavaScript you will be using. If you only need file uploading your template could look like the basic setup. (However, you should minify and concatenate your files for a deployed website).

  3. You return a JSON response to the upload handler so that the script handler performing the XHR file upload request can know things like:

    • What the URL for the uploaded image is (and the thumbnail, if you are making thumbnails).
    • What the delete URL (and method) is.

The linked example for Flask seems very similar to the Django example for the new version - you can probably start with that and then patch it to work with the new version of jQuery file upload.