dpd-fileupload
dpd-fileupload copied to clipboard
Check if file already exists
If a file with the same name already exists, we should handle that:
- throw an error or
- append (n) at the end of the file
Check should probably be before this line. https://github.com/NicolasRitouet/dpd-fileupload/blob/master/index.js#L117
A couple of other alternatives are
- to save the file as a different name when it's uploaded (maybe just use the deployd ID as the faux filename) and store the original filename in the db.
- replace the existing file with the new one
I'm personally not a big fan of replacing the existing file (maybe a param that you could pass). The default behaviour could be to append a number at the end of the file and with a param, you could be able to replace the existing file. Any other opinion from "the community"?