How to determine MIME type of file in android?

Suppose I have a full path of file like:(/sdcard/tlogo.png). I want to know its mime type. I created a function for it public static String getMimeType(File file, Context context) { Uri uri = Uri.fromFile(file); ContentResolver cR = context.getContentResolver(); MimeTypeMap mime = MimeTypeMap.getSingleton(); String type = mime.getExtensionFromMimeType(cR.getType(uri)); return type; } but when i call it, it … Read more

How to check file MIME type with javascript before upload?

I have read this and this questions which seems to suggest that the file MIME type could be checked using javascript on client side. Now, I understand that the real validation still has to be done on server side. I want to perform a client side checking to avoid unnecessary wastage of server resource. To … Read more

Proper MIME type for .woff2 fonts

Today I updated Font Awesome package to 4.3.0 and noticed that woff2 font was added. That file is linked in CSS so I need to configure nginx to serve woff2 files properly. Currently I have this block in nginx config for fonts: location ~* \.(otf|eot|woff|ttf)$ { types {font/opentype otf;} types {application/vnd.ms-fontobject eot;} types {font/truetype ttf;} … Read more

Chrome says “Resource interpreted as script but transferred with MIME type text/plain.”, what gives?

In FF and all, my javascript works fine. But in Chrome it gives this message: Resource interpreted as script but transferred with MIME type text/plain. I have checked all the script tags and they all have the MIME type=”text/javascript”. It even says so with jquery and jquery ui. What is wrong with Chrome? What’s the … Read more