decode_multipart


Description:


[ Version ( since = "2.26" ) ]
public HashTable<unowned string,unowned string>? decode_multipart (Message msg, string? file_control_name, out string filename, out string content_type, out Buffer file)

Decodes the "multipart/form-data" request in msg; this is a convenience method for the case when you have a single file upload control in a form.

(Or when you don't have any file upload controls, but are still using "multipart/form-data" anyway.) Pass the name of the file upload control in file_control_name, and decode_multipart will extract the uploaded file data into filename , content_type, and file. All of the other form control data will be returned (as strings, as with decode) in the returned GenericSet.

You may pass null for filename, content_type and/or file if you do not care about those fields. decode_multipart may also return null in those fields if the client did not provide that information. You must free the returned filename and content-type with g_free, and the returned file data with free.

If you have a form with more than one file upload control, you will need to decode it manually, using Multipart.from_message and get_part.

Parameters:

msg

a Message containing a "multipart/form-data" request body

file_control_name

the name of the HTML file upload control, or null

filename

return location for the name of the uploaded file, or null

content_type

return location for the MIME type of the uploaded file, or null

file

return location for the uploaded file data, or null

Returns:

a hash table containing the name/value pairs (other than file_control_name) from msg, which you can free with g_hash_table_destroy. On error, it will return null.


Namespace: Soup.Form
Package: libsoup-2.4