Answer the question
In order to leave comments, you need to log in
Which way to save the image?
In general, there is a model for adding material to the site. Adding images via Ajax is implemented in the view. When adding an image, a number of folders are generated, one of which has the identifier of the entry being added as its name (while adding an image to an existing entry is implemented). So, my question is: which one to choose the best option for uploading an image?
1) (not considered) adding one to the last entry
2) create a temporary directory. But then the problem arises that if a person uploaded an image and changed his mind about adding material, then the file will remain hanging in the temporary directory
Answer the question
In order to leave comments, you need to log in
One of the options is to add the file to the temporary directory
. Next, check, for example, once a month the last access time to this file if FS allows and you can compare and if you need to delete,
I checked the last access time every 9 months and deleted the unused file :)
//y I had a difficult project and it was necessary to check exactly every 9 months
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question