Qore Mime Module Reference 1.4.4
Loading...
Searching...
No Matches
Misc MIME Functions

Functions

string Mime::get_mime_type_from_ext (string path, string def_type=MimeTypeUnknown)
 
string Mime::mime_decode_urlencoded_string (string str)
 decodes the given string from URL encoded format More...
 
string Mime::mime_get_form_urlencoded_string (hash h)
 returns a string in MIME multipart form URL encoded format (for use with "Content-Type: application/x-www-form-urlencoded" data) More...
 
string Mime::mime_get_urlencoded_string (auto val)
 returns a single string in MIME URL encoded format More...
 
hash< auto > Mime::mime_parse_form_urlencoded_string (string str)
 returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with "Content-Type: application/x-www-form-urlencoded" data) More...
 

Detailed Description

Function Documentation

◆ get_mime_type_from_ext()

string Mime::get_mime_type_from_ext ( string  path,
string  def_type = MimeTypeUnknown 
)

returns the mime type for the given filename from the extension or the default type if the extension is not present or unknown

◆ mime_decode_urlencoded_string()

string Mime::mime_decode_urlencoded_string ( string  str)

decodes the given string from URL encoded format

Parameters
strthe URL encoded string to decode
Returns
the decoded string
See also
RFC 2738 2.2
Since
Mime 1.3.4.1

◆ mime_get_form_urlencoded_string()

string Mime::mime_get_form_urlencoded_string ( hash  h)

returns a string in MIME multipart form URL encoded format (for use with "Content-Type: application/x-www-form-urlencoded" data)

Parameters will be separated by "&" characters. All key values must be strings or convertible to strings or a URLENCODED-TYPE-ERROR exception is thrown

Parameters
hthe hash to use to generate the string
Returns
a string in application/x-www-form-urlencoded format
Exceptions
URLENCODED-TYPE-ERRORhash value cannot be converted to a string
INVALID-CHARACTERan invalid character has been found
See also
RFC 2738 2.2
Since
Mime 1.3.4.1

◆ mime_get_urlencoded_string()

string Mime::mime_get_urlencoded_string ( auto  val)

returns a single string in MIME URL encoded format

reserved characters are replaced with percent encoding, characters outside the ASCII character set cause an exception to be thrown

Parameters
valthe input value
Returns
the output string in MIME URL encoded format
Exceptions
INVALID-VALUEthe value given cannot be converted to a string
INVALID-CHARACTERan invalid character has been found
See also
RFC 2738 2.2
Note
spaces are not replaced with '+' signs but rather encoded as %20 because '+' signs are often encoded and decoded improperly in URLs, and %20 is unambiguous
Since
Mime 1.3.4.1

◆ mime_parse_form_urlencoded_string()

hash< auto > Mime::mime_parse_form_urlencoded_string ( string  str)

returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with "Content-Type: application/x-www-form-urlencoded" data)

Parameters
strthe string to parse
Returns
the hash corresponding to the string, where values are always of type *string unlessa key is repeated, in which case the key's value will be a list of all elements provided
Exceptions
URLENCODED-PARSE-ERRORcannot parse the given string
See also
RFC 2738 2.2
Since
Mime 1.3.4.1