How to find if the file is a CSV file?

Posted by Mithun on Stack Overflow See other posts from Stack Overflow or by Mithun
Published on 2010-06-18T09:33:33Z Indexed on 2010/06/18 9:43 UTC
Read the original article Hit count: 216

Filed under:

I have a scenario wherein the user uploads a file to the system. The only file that the system understands in a CSV, but the user can upload any type of file eg: jpeg, doc, html. I need to throw an exception if the user uploads anything other than CSV file.

Can anybody let me know how can I find if the uploaded file is a CSV file or not?

© Stack Overflow or respective owner

Related posts about csv