Uploading files to the server
To upload a file to the server, use a PUT or POST request.
Creating a PUT request
To upload a file using a PUT request, pass the following URI:
https://localhost/flexicapture12/server/MobileApp?filename=[file name]&projectName=[project name]&batchType=[batch name], where:
|projectName||The name of the project. Required parameter|
|batchType||The name of the batch. Required parameter. If no value is specified, the default batch type will be used.|
|filename||The name of the file that is to be uploaded. Required parameter|
We recommend that you explicitly specify the value of the Content-type header field. The file to be uploaded is specified in the body of the PUT request.
Hash coding is supported. Pass the value of the MD5 hash function to the FlexiCapture 12 server. La valeur doit être codée en Base64 à l'aide de UTF-16LE et transmise dans l'en-tête standard Content-MD5. The server will compute the value of the hash function for the file and compare it against the value passed in the header. If the values do not match, the file will be deleted on the server.
There are two possible server responses:
- HTTP 201 (Created) - The file has been successfully uploaded to the server.
- HTTP 400 (Bad request) - Some required parameters have not been specified/The value of the hash function does not match the value specified in the header and no file has been uploaded.
Remarque : Currently, you cannot pass the registration parameters to the server.
Creating a POST request
We recommend using PUT requests. If, for some reason, PUT requests cannot be used, 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.
You can pass multiple images in one POST request. To pass multiple images, set the value of the Content-type field to "multipart/form-data" and specify the value of the separator in the boundary parameter. The names of the files included in a request must not be the same.
Example of passing multiple files
Content-type: multipart/form-data; boundary=<random string>
Content-Disposition: form-data; name=<field name>; filename=<name of file 1><crlf>
Content-MD5: <value of MD5 hash for file><crlf>
Content-Disposition: form-data; name=<field name>; filename=<name of file 2><crlf>
You can also pass a text field using a POST request.
Example of passing a text field
Content-Disposition: form-data; name=”<field name>”<crlf>
The request ends with the string