Hi All, I am uploading images to SQL Server 2005 using asp.net. The database table has a binary field, image length field,file path field and a field for the file type. The issue is that the user is able to upload the same image to the database using different file names. What unique property should I check for to prevent duplicate images from being uploaded. I tried checking the file length but two different images can have the same length, so this prevented a new image from being uploaded. Anyone has any idea?
I'm not sure if that is even possible because I think once you rename the file it changes the image code so I don't know if there would be anything you could match.
Hi, assuming that you are storing the image in a field in the database, just find any fields that are the same length in bytes as the inputted file... if one exists, compare the bytes of the file to the bytes within the database, if they are the same then you have a duplicate. If you want some sample code let me know.
You could compare the MD5 hash of the images: h**p://bytes.com/topic/visual-basic-net/answers/372658-getting-md5-hash-image-file