Estimate if file is MIME type

前端 未结 3 516
执念已碎
执念已碎 2021-01-12 10:47

This method should be check if a file is MIME type. To achieve this goal I am using method probeContentType().
However maybe is another way to decide same question. Whic

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 10:55

    You can use String mimeType = new MimetypesFileTypeMap().getContentType(theFile);.

    Note that if no MIME type is found, application/octet-stream is returned instead of null.

提交回复
热议问题