Hi, I am supposed to upload a file which should be of type csv. Now after I upload the file from my jsp I am using the jakrta file upload utility to write it to some specified folder. But the functionality requuires me to verify that the file is truly a csv file before I write it to the specified directory. Can anyone suggest how I can validate the type of a uploaded file to be csv?
Yeah the java API doesn't give any validation for csv files. For Netscape/Firefox/IE the file content type for a csv file comes as application/octet-stream. I am validating that the file uploaded by the user has this type and extension csv. However as you might have guessed that if I intentinally save a bitmap file with a csv extention then also this validation succeeds. So this is a *poor* way to validate csv files. Any ideas on how this validation can be done in a better way?
thanks and regards, Sunetra.
Joined: Jan 22, 2002
I think you have to implement the csv specification by yourself. You can find the specification on the next url: