Did you know ... | Search Documentation: |
MIME support |
Simple and partial implementation of MIME encoding. MIME is covered
by RFC 2045. This library is used by e.g., http_post_data/3
when using the
form_data(+ListOfData)
input specification.
MIME decoding is now arranged through library(mime)
from
the clib package, based on the external librfc2045 library. Most likely
the functionality of this package will be moved to the same library
someday. Packing however is a lot simpler then parsing.
=
Valuefilename
is present if Value is of the form file(File)
.
Value may be any of remaining value specifications.
Content-Disposition: form-data; name="Name"[; filename="<File>"
Content-type
is
derived from the File using file_mime_type/2.
If the content-type is text/_
, the file data is copied in
text mode, which implies that it is read in the default encoding of the
system and written using the encoding of the Out stream.
Otherwise the file data is copied binary.type(ContentType)
and/or character_set(CharSet)
.
This can be used to give a content-type to values that otherwise do not
have a content-type. For example:
mime([type(text/html)], '<b>Hello World</b>', [])
Out | is a stream opened for writing. Typically, it should be opened in text mode using UTF-8 encoding. |