• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java EE /Struts: Checking for corruption in file during file upload  RSS feed

 
Dilip H Pashupathi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an web application that I am working on in my company. The requirement is that user can upload documents through the user interface provided. This i have already implemented. But problem is if a user tries to upload a corrupted file through the UI, that is also getting uploaded. This should not happen. Is there any way in java to check if the file is corrupted or not. I tried with file formats that is MIME types but that does't help.

Thanks and Regards.
Dilip
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you defining file corruption? Is this mean cannot open, malformed data, incorrect columns... this kind of stuff?

Usually to check if a file is corrupted, a MD5 hash or some other hash algorithm is used. The problem is how to generate such hash if the original file doesn't provide.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!