/*package*/ static String getFileContentType(File file) { String filename = file.getName(); String contentType = HttpURLConnection.guessContentTypeFromName(filename); if (TextUtils.isEmpty(contentType)) { contentType = "application/octet-stream"; } return contentType.replaceFirst("\\/jpg$", "/jpeg"); }