jQuery.mime()
Categories: Utilities
jQuery.mime( ext )Returns: String
Plugin: jQuery.mime
Description: Get the MIME type by file extension.
-
jQuery.mime( ext )
version added: 1.0ext A file extension like 'jpeg','doc' or ....
This method converts a file extension to a MIME type using the jQuery.mimeSettings.mimeRegxMap
properties.
If the extension doesn't match a MIME type jQuery.mime()
retuns to unknow mime which is specifiend in
jQuery.mimeSettings.unknow
property.
-
Get MIME type from jpg file extension.
Code:
$.mime("jpg");
Results:
image/jpeg
jQuery.mime( mimes )Returns: String
Plugin: jQuery.mime
Description: Replace MIME groups with specified mimetypes.
-
jQuery.mime( mimes )
version added: 1.0mimes A string of MIME types and/or MIME groups.
This method replace MIME groups with MIME types specified in jQuery.mimeSettings.groups
.
-
Replace a MIME group.
Code:
$.mime("image/tiff,previewable/*");
Results:
image/tiff,image/png,image/jpeg,image/jpg,image/gif,image/vnd.microsoft.icon
-
A not speciefied MIME group will be not replaced.
Code:
$.mime("image/tiff,image/*");
Results:
image/tiff,image/*
jQuery.mime( mimes, accept )Returns: Boolean
Plugin: jQuery.mime
Description: Checks if a MIME type or file extension is accepted.
-
jQuery.mime( mimes, accept )
version added: 1.0mimes A MIME type or file extension.
accept A string of MIME types and/or MIME groups as acception.
This method replace MIME groups with MIME types specified in jQuery.mimeSettings.groups
.
-
Check some mimes or file extensions of acception.
Code:
$.mime( "image/tiff" "previewable/*"); // results: false $.mime( "image/jpg" "previewable/*"); // results: true $.mime( "png" "previewable/*"); // results: true $.mime( "doc" "previewable/*"); // results: false