ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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.
Remark: This function is equivalent to fMIMEType.
Example
// 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:
    mimeTypeXMLApplicationXML content.
    mimeTypeBinaryBinary content (byte stream).
    mimeTypeDOCWord file (*.doc)
    mimeTypeDOCXWord file (*.docx)
    mimeTypeGIFGIF image (*.gif)
    mimeTypeHTMLHTML page (*.htm, *.html)
    mimeTypeJPEGJPEG image (*.jpg, *.jpeg)
    mimeTypeJSONJSON content.
    mimeTypePDFPDF document (*.pdf)
    mimeTypePNGJPEG image (*.png)
    mimeTypeSOAPSOAP content in XML format.
    mimeTypeTextText (*.txt)
    mimeTypeXMLTextXML text
    mimeTypeXLSExcel file (*.xls)
    mimeTypeXLSXExcel file (*.xlsx)
    mimeTypeZIPZIP file (*.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.
Component: wd290std.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/31/2022

Send a report | Local help