Of course an error will happen. But, that case is imposible if you use the script in a normal situation. You have modified the database.
When an user upload an image or video, it will have a unique name. There will not two file with the same name. And of course, a regular user won’t delete the file ‘installed’. That case would happen if you want to reinstall the database, so you would have to empty the database too.
What I want to explain is that the errors in the script are when you make a normal use of the script.
Regards