get mine type for custom upload file
/**
* get mine type of file
*
* @param path
* @return mine type for upload file
*/
public static String getMimeType(String path, String useThisIfNull) {
String type = useThisIfNull;
String extension = null;
int i = path.lastIndexOf('.');
if (i > 0) {
extension = path.substring(i+1);
}
if (extension != null || extension == "") {
MimeTypeMap mime = MimeTypeMap.getSingleton();
type = mime.getMimeTypeFromExtension(extension);
}
return type;
}