/usr/lib/swipl/library/ext/http/http/http_multipart_plugin.pl
All Application Manual Name SummaryHelp

  • http
    • http
      • http_unix_daemon.pl
      • thread_httpd.pl -- Threaded HTTP server
      • http_wrapper.pl
      • http_header.pl -- Handling HTTP headers
      • http_stream.pl
      • http_exception.pl -- Map Prolog exceptions to HTTP errors
      • http_path.pl -- Abstract specification of HTTP server locations
      • http_dispatch.pl
      • http_host.pl -- Obtain public server location
      • http_client.pl
      • http_open.pl -- HTTP client library
      • http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests
      • http_multipart_plugin.pl -- Multipart form-data plugin
        • http_convert_data/4
      • http_hook.pl -- HTTP library hooks
      • html_write.pl -- Write HTML text
      • html_quasiquotations.pl
      • html_decl.pl
      • js_write.pl -- Utilities for including JavaScript
      • http_server_files.pl -- Serve files needed by modules from the server
      • hub.pl -- Manage a hub for websockets
      • websocket.pl -- WebSocket support
      • http_session.pl
      • http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing
      • mimetype.pl -- Determine mime-type for a file
      • html_head.pl
      • term_html.pl -- Represent Prolog terms as HTML
      • http_dyn_workers.pl -- Dynamically schedule HTTP workers.
      • http_server.pl -- HTTP server library
      • http_server_health.pl -- HTTP Server health statistics
      • http_log.pl -- HTTP Logging module
      • http_redis_plugin.pl -- Hook session management to use Redis
      • mimepack.pl -- Create a MIME message
 http_client:http_convert_data(+In, +Fields, -Data, +Options) is semidet[multifile, library(http/http_multipart_plugin)]
Convert multipart/form-data messages for http_read_data/3. This plugin adds the following options to http_read_data/3:
form_data(+AsForm)
If the content-type is multipart/form-data, return the form-data either in one of the following formats:
AsForm=form
A list of Name=Value, where Value is an atom.
AsForm=mime
A list of mime(Properties, Value, []). This is a backward compatibility mode, emulating library(http/http_mime_plugin). Note that if the disposition contains a filename property, the data is read as binary unless there is a charset parameter in the Content-Type stating otherwise, while the old library would use UTF-8 for text files.
input_encoding(+Encoding)
Encoding to be used for parts that have no filename disposition and no Content-Type with a charset indication. This is typically the case for input widgets and browsers encode this using the encoding of the page. As the SWI-Prolog http library emits pages in UTF-8, the default is utf8.
on_filename(:CallBack)
If a part with a filename disposition is found and this option is given, call CallBack as below. Stream is the multipart input stream, which has octet (raw) encoding. Value is returned as result. Note that the callback may wish to save the result into a file and return e.g., file(Path) to indicate where the file was saved.
call(:CallBack, +Stream, -Value, +Options).

The Options list contains information from the part header. It always contains name(Name) and filename(FileName). It may contain a term media(Type/SubType, Params) if the part contains a Content-Type header.