Upload one file

The maximum file size supported by the service is 100 MB.

HTTP REQUEST

POST

URL

https://cloud.dynamsoft.com/rest/ocr/v1/file

Request Parameters

Parameters Type If Mandatory Description
method string Yes Fixed value: upload
x-api-key string Yes DDC API Key. When making any API request, pass your key as the value of an x-api-key parameter in the Header.
file_name string Yes The filename being uploaded
Note:
Filename cannot be empty, including \r, \n, \t, space, \0, \x0B
Filename cannot include invalid characters, e.g., <, >, :, etc.
file char[] Yes File content
ondup string Yes Behavior on duplicate
Overwrite: replace the file with the same filename;
Newcopy: create a new copy and rename the copy as "filename(0).type".

Note:
File and file_name need to be sent in POST form data. Ondup can be sent in query_string or POST data form.
Response Parameters

Parameters Type UrlEncode Description
file_name string Yes Filename returned from the server. If ondup is set as Newcopy, this value might be different from the original name.
size int32 No File size by byte
ctime int32 No File create time
mtime int32 No File modify time
md5 String No File md5 signature
error_code int32 No Error code
error_msg string No Error message
request_id string No Request ID

Sample Code
Request Body:

x-api-key: z81QwIA3kg0tUXkueP+QN4qXFCP0MIQIqDn94uxoVPdcnnGArr366w==
POST https://cloud.dynamsoft.com/rest/ocr/v1/file?method=upload

Response:

{
     'file_name': 'f1.jpg',
     'size': 372121,
     'ctime': 1234567890,
     'mtime': 1234567890,
     'md5': 'cb123afcc12453543ef',
     'error_code': 0,
     'error_msg': 'Success.',
     'request_id':3043312669
}
Is this page helpful?

Leave a Reply

Your email address will not be published.