dpd-fileupload icon indicating copy to clipboard operation
dpd-fileupload copied to clipboard

Check if file already exists

Open NicolasRitouet opened this issue 11 years ago • 2 comments

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

NicolasRitouet avatar Jun 02 '14 07:06 NicolasRitouet

A couple of other alternatives are

  1. 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.
  2. replace the existing file with the new one

EvilDrW avatar Oct 29 '15 14:10 EvilDrW

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"?

NicolasRitouet avatar Oct 29 '15 16:10 NicolasRitouet