> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload files to the server

> Upload images to the ABBYY FlexiCapture server through the Mobile API using PUT or POST requests, with MD5 hash verification and multipart support.

To upload a file to the server, use a PUT or POST request.

## Create a PUT request

To upload a file using a PUT request, pass the following URI:

```http theme={null}
https://localhost/flexicapture12/server/MobileApp?filename=[file name]&projectName=[project name]&batchType=[batch name]
```

The URI accepts these parameters:

| Parameter     | Description                                                                                |
| ------------- | ------------------------------------------------------------------------------------------ |
| `projectName` | The name of the project. Required.                                                         |
| `batchType`   | The name of the batch. Required. If no value is specified, the default batch type is used. |
| `filename`    | The name of the file to be uploaded. Required.                                             |

We recommend that you explicitly specify the value of the `Content-type` header field. Specify the file to be uploaded in the body of the PUT request.

The server supports hash coding. Pass the value of the MD5 hash function to the FlexiCapture 12 server. Encode the value in Base64 using UTF-16LE and pass it in the standard `Content-MD5` header. The server computes the hash function value for the file and compares it against the value passed in the header. If the values do not match, the file is deleted on the server.

Two server responses are possible:

* **HTTP 201 (Created)** – The file was uploaded to the server successfully.
* **HTTP 400 (Bad request)** – A required parameter is missing, or the hash function value does not match the value specified in the header. No file was uploaded.

<Note>
  Currently, you cannot pass the registration parameters to the server.
</Note>

## Create a POST request

We recommend using PUT requests. If PUT requests cannot be used for some reason, you can upload a file to the server using a POST request. The `projectName` and `batchType` parameters can be passed in the URL, just like in a PUT request, or as text fields in the request body.

### Pass multiple images in one request

You can pass multiple images in one POST request. Set the value of the `Content-type` field to `multipart/form-data` and specify the separator value in the `boundary` parameter. The names of the files included in a request must not be the same.

The following example passes two files in a single request:

```http theme={null}
Content-type: multipart/form-data; boundary=<random string>
--<boundary value>
Content-Disposition: form-data; name=<field name>; filename=<name of file 1><crlf>
Content-MD5: <value of MD5 hash for file><crlf>
<crlf>
<file data>
--<boundary value>
Content-Disposition: form-data; name=<field name>; filename=<name of file 2><crlf>
<crlf>
<file data>
```

### Pass a text field

You can also pass a text field in a POST request:

```http theme={null}
--<boundary value>
Content-Disposition: form-data; name="<field name>"<crlf>
<crlf>
<field value><crlf>
```

End the request with this boundary string:

```http theme={null}
--<boundary value>--<crlf><crlf>
```
