# reqwest.multipart ## Function Set the multipart/form-data request body for submitting ordinary fields and file fields. ## Syntax ```bt reqwest(url).multipart(values) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | values | Object | Yes | None | A multipart field mapping object; rules for keys and values are given below. | ## values object structure | key | value type | description | | ------ | ------ | ------ | | Field name | Any | Ordinary field, it will be converted into a string when called. | | Field name | Object | File field; path must be provided in the object, file_name, mime are optional. | ## File field object structure | Field | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | path | String | Yes | None | The local file path to upload. | | file_name | String | No | Original file name | The file name exposed to the server when uploading. | | mime | String | No | Automatically identify | file MIME type, for example `image/png`. | ## Return value | Type | Description | | ------ | ------ | | Reqwest | Returns the new request builder. | ## Example ```bt request = reqwest('https://example.com/upload').method('POST').multipart({ name: 'BT', file: {path: 'demo.txt', file_name: 'demo.txt', mime: 'text/plain'} }) result = type(request) // Output: Reqwest print result ``` ## Notes - values must be objects, otherwise an error will be reported. - Body, json, form, and multipart will all set the request body; the last request body set in the same request will take effect.