*Description:*
Using the *PersistedTemporaryFileUploadHandler* upload handler, Django will 
write the uploaded file to a temporary file stored in your system's 
temporary directory, as the *TemporaryFileUploadHandler* already do. 
However, the file this time will not be suppressed after your first read, 
and will persist until you delete it. 

*PersistedTemporaryFileUploadHandler* class inherit from the 
*TemporaryFileUploadHandler* class. No big changes, only to set the delete 
args of the *NamedTemporaryFile *to *False* 

*Use cases:*

   - One use case that I personally faced is having many threads reading 
   from the same uploaded file. When one of the threads reads the file 
   content, the file is automatically deleted, and so became unavailable for 
   the other threads. 
   - Another use case was find in a ​stack overflow 
   
<https://stackoverflow.com/questions/11835274/django-control-time-of-temporaryuploadedfile-life/76021825>
 
   question, where a user was looking for a way to control the life time of 
   the uploaded file. 

*N.B:*
Even thought it may be easy to forbid the temporary file from being 
deleted, I think it's a necessary feature or class to have withing the 
framework as it's a behavior that I would naturally consider available in 
such a great framework. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4c72df4c-83b6-4c88-b4a4-865a43d208ean%40googlegroups.com.

Reply via email to