:- use_module(library(http/mimepack)).
=
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. |