Click to See Complete Forum and Search --> : Checking for damaged files


bulgarian388
05-15-2007, 10:35 PM
Hi guys, i have a website that the owners have the ability to add products and for each product they can add as many images as they want which get viewed in a lightbox gallery on the main page. The problem is that I found that some images are damaged on the server so they fail to load. I need to get a way to check if the file is damaged with asp.net when the owners are in the admin panel for the site, and raise an alert to replace that image, but i dont know how to do that in .net. If anyone knows, please let me know. I figured that just trying to edit the file might be enough to find out if its damaged.

Thanks in advance for any ideas.

Ribeyed
05-17-2007, 05:14 PM
Hi,
not sure if this will help but the FolderWatcher class has methods for monitoring file and folder activity.
http://www.codeproject.com/dotnet/folderwatcher.asp

Cstick
05-21-2007, 12:11 AM
I think you are saying that the files are uploaded and stored just fine, however later the files become corrupted. In this case, you could hash the files when they are first received and when it is time to use the file later, rehash and compare with the original hash. If the hashes are the same, then the file is good else it is corrupted.

Personally, I'd want to figure out why files are corrupted in the first place.