Returns the type of file according to the MIME standard (Multipurpose Internet Mail Extensions). The "Content Type" tells the software how it should interpret the file.
New in version 28Remark: This function is equivalent to
fMIMEType.
// Add attachments to an email
arrAttachment is array of strings = ["image.png", "video.mpeg", "file.pdf"]
myEmail is Email
...
FOR EACH sFile OF arrAttachment
// Build the emailAttach variable
myAttach is emailAttach
myAttach.Name = sFile
myAttach.Content = fLoadBuffer(sFile)
// fContentType returns "image/png" for "image.png",
// "vide/mpeg" for "video,mpeg" and "application/pdf" for "file.pdf"
myAttach.ContentType = fContentType(sFile)
// Add the attachment
Add(myEmail.Attach, myAttach)
END
// Display a file in the user's browser in server code
FileDisplay(sFile, fContentType (sFile))
Syntax
<Result> = fContentType(<File path>)
<Result>: Character string
- File type according to MIME standard:
| |
typeMimeXMLApplication | XML content. |
typeMimeBinary | Binary content (byte stream). |
typeMimeDOC | Content such as Word file (*.doc) |
typeMimeDOCX | Content such as Word file (*.docx) |
typeMimeGIF | Content such as Image in GIF format (*.gif) |
typeMimeHTML | Content such as HTML page (*.htm, *.html) |
typeMimeJPEG | Content such as image in JPEG format (*.jpg, *.jpeg) |
typeMimeJSON | JSON content. |
typeMimePDF | Content such as PDF document (*.pdf) |
typeMimePNG | Content such as image in JPEG format (*.png) |
typeMimeSOAP | SOAP content in XML format. |
typeMimeText | Content in text format (*.txt) |
typeMimeXMLText | Text content in XML format |
typeMimeXLS | Content in Excel format (*.xls) |
typeMimeXLSX | Content in Excel format (*.xlsx) |
typeMimeZIP | Content in ZIP format (*.zip) |
- Empty string ("") if the MIME type could not be determined.
<File path>: Character string
- Name and full (or relative) path of the file (up to 260 characters).
- Full (or relative) path of directory (up to 260 characters). If this parameter corresponds to a directory name, this name may (or may not) end with "\".
A UNC path can be used.
Remarks
The MIME type is determined from the file extension.