Monday, March 25, 2013

How to get Mime Type in simple way.



Call method
getMimeType("file://" + dosPath)


public static String getMimeType(String fileUrl) throws java.io.IOException, MalformedURLException {
              String type = null;
              URL u = new URL(fileUrl);
              URLConnection uc = null;
              uc = u.openConnection();
              type = uc.getContentType();
              return type;
}

No comments:

Post a Comment

How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model

 Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...