Detect File Type?

I’m building an application that will allow a user to uload a .csv file through a browser. The application then takes the .csv file and creates documents in the database.

My question is: Is there any way for me to verify that the file is, in fact, a .csv file?

I’m currently working on getting the attachment name, and checking the extension, but I was hoping for a better way to validate the actual file.

That way if someone renames a .xls to a .csv I can detect it. Or if someone uloads a .txt, I can use it.

Thanks,

Vic

Subject: RE: Detect File Type?

There’s no way to get at the contents of the file, except by detaching it to disk. Use NotesEmbeddedObject.ExtractFile, then use the file functions to read data from it and see whether it looks like the type of file you expect.