Skip to main content
Version: v18


Returns an ID of the file uploaded to the server


Post this request when you have a file that you want to upload to the Server. If you have an image, you pass $rawPict=true. For all other files, you pass $binary=true.

You can modify the timeout, which by default is 120 seconds, by passing a value to the $timeout parameter.

Image upload example

To upload an image, you must first select the file object on the client using the HTML 5 built-in API for using file from a web application. 4D uses the MIME type attribute of the file object so it can handle it appropriately.

Then, we upload the selected image to 4D Server:

POST /rest/$upload?$rawPict=true


{ "ID": "D507BC03E613487E9B4C2F6A0512FE50" }

Afterwards, you use this ID to add it to an attribute using $method=update to add the image to an entity:

POST /rest/Employee/?$method=update

POST data:

__KEY: "12",
__STAMP: 4,
photo: { "ID": "D507BC03E613487E9B4C2F6A0512FE50" }


The modified entity is returned:

"__KEY": "12",
"__STAMP": 5,
"uri": "",
"ID": 12,
"firstName": "John",
"firstName": "Smith",
"uri": "/rest/Employee(12)/photo?$imageformat=best&$version=1&$expand=photo",
"image": true