In certain situation users can send temporary files to my server. I would like to keep track of those temporary files (since they are used later and I would like to know, when I can remove them – or when they weren’t used and can be collected). What kind of model should I use for it? I will send those files using AJAX (and iframe).
EDIT
If I use in the model FileField, how should I handle file upload? Could you show some example snippet, how my function should put file from request.FILES to a FielField.
How you store the files is independent of whether or not they come via AJAX. Your view will still need to process the multipart form data, and store it in your DB and server filesystem, like any other uploaded file in Django.
As far as the model goes, how about something like this?
For basic file upload handling see the official documentation, but where the example has the handle_uploaded_file() method, you need some code that creates a TemporaryFileWrapper object, something like this, depending on your needs: