1๐
โ
I think your first way with some reformations is the best way. You can create a tmp
directory and attach a unique data (e.g. IP address) to each image that takes control on concurrency and then write some script in $(window).unload(...)
for send a signal to the backend that remove the image(s) from tmp
directory when user close window before submitting the form.
๐คuser6242689
Source:stackexchange.com