Giter Site home page Giter Site logo

Using Ajax with demo about imageuploads HOT 4 CLOSED

mtmarsh2 avatar mtmarsh2 commented on August 18, 2024
Using Ajax with demo

from imageuploads.

Comments (4)

archatas avatar archatas commented on August 18, 2024

The django-ajax-uploader is used to upload an image by Ajax to the server and get the temporary path of that image. As you see, the upload happens immediately, when you select an image from your filesystem, NOT when you click on the submit button.

The form itself in this example doesn't use Ajax. It just submits the temporary image path and then the image is copied from the temporary upload path to its final destination. If you need Ajaxified version of the form with the hidden field too, it is not too difficult to modify the view and add some Ajax handling javascript for the form.

from imageuploads.

mtmarsh2 avatar mtmarsh2 commented on August 18, 2024

Ahh okay that makes sense, so when the user adds a image from their filesystem, the image is immediately sent to the server, which is the ajax part, thanks for clearing that up

from imageuploads.

mtmarsh2 avatar mtmarsh2 commented on August 18, 2024

One more question: How does the system know what to do when a user selects a picture, but then doesnt actually do a post request? The image should then be deleted from the filesystem, since the user for example, clicked the back button, right?

from imageuploads.

archatas avatar archatas commented on August 18, 2024

This app example doesn't cover that, but there could be a management command run by a cron job which deletes all temporary files in the directory which are older than (let's say) a day.

from imageuploads.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.