File Type method

Jul 20, 2008 at 7:33 PM
Hi, is there a way to obtain the file type from a file in an archive when extracting it?
Coordinator
Jul 22, 2008 at 1:22 AM
What do you mean "type of the file."  ? 
You get the name, the size, the last modified time, and so on. 
The filename includes the file extension, if that's what you mean.
Jul 22, 2008 at 8:47 AM
the type of file like you get with the .net FileUpload object, i.e. "application/pdf"
Coordinator
Jul 22, 2008 at 10:01 PM
Edited Jul 22, 2008 at 10:19 PM
That information is not stored in the zip file, so it is not available to the application.
Sorry!

I should add, if you would like to find the content type of the file, you can look in the registry, under
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type

There you will find a list of content-types and the extensions that are mapped to them.
Using the Registry classes, you could build some logic that scans that list and returns the content-type for the extesion you find.

Keep in mind this means the mapping is different for each machine. It varies depending on the applications that are installed on it.  If you have photoshop installed on a machine, then the registry will contain a content-type mapping for the photoshop format.  I don't have PhotoShop, so I don't  have that mapping in the registry on my machine.
Jul 23, 2008 at 8:21 AM
Thanks very much for the response.