I let users to upload photos.
User can upload multiple photos at once using flash mechanism.
User may try to upload same file twice or more times.
Ideally user should not have same photo twice. This may flood the system.
How do I prevent the user from uploading duplicate files?
What is the right approach to handle this?
Will I prevent user letting upload duplicate files?
Currently I am checking each file if user has it using ajax WS call.
But user won’t upload duplicate file that often, but the cost for check is always.
OR
I can avoid the costly checking and check during saving only?
OR
Save user file with differnt name?
Just trying to see how would someone else do this.
Thanks
If you save using a guid for the name to can be sure you are never going to copy over an existing file
or
To reduce the cost of the file check, cache your file data using something like Enlib saving the Name, Size, etc. that way you can do a quick check to see if the data matches vs calling the system.IO to check your files