cancel
Showing results for 
Search instead for 
Did you mean: 

I want to know file´s mimetype

alfredomuã_ozco
Champ in-the-making
Champ in-the-making
I have created a method that upload a file to the repository, passing  a String with mimetype of the file, but I want to overload this method being allowed to pass the file like argument, and after the file to get its name, and his mimetype.

Somebody can help me, I have seen the MimetypeMap class , the Map contains the extensions and mimetypes . Somebody can say to me like using this class to obtain mimetype of the file that I want to upload.
Thank´s
      Alfredo
2 REPLIES 2

tiennd
Champ in-the-making
Champ in-the-making
Hi,
After initialize the Map, just call GuessMimetype(fileName) and you will get a mimetype string. It's working great for me.

Regards

alfredomuã_ozco
Champ in-the-making
Champ in-the-making
Thank you very much.

My problem is when uploading  external files , I want to know mimetype of the object that I am going to upload, for passes it  to the CMLCreate class.

Finally I have chosen to use the bookstore jmimemagic.

Greetings
    ALFREDO