Use an existing facet when you want to copy a file property. Note when creating file properties using existing facets, the source data is always copied. The following are all examples of valid content facet reference property values:
The following are all examples of valid content upload property values:
"file://image.png"
"upload://image.png"
"image.png"
{upload: "image.png"}
{source: "upload", filename: "image.png"}
Uploading files is a two-stage process. Firstly, the File property is written. A good example is the Account image, which consists of a content facet that expects an image. The value of the property must be an object whose properties are the configured, uploaded facet names, with their being filenames with extensions matching the content-type accepted by the facet. For example,
updating an Account image:Example
The response contains new facets with a state of 0 (Pending).
For uploads, the next step is to scan the uploads array in the response and make an HTTP multipart/form-data POST for each entry in the array. For each entry:
Build a form containing the fields defined in using the fields array in the order they appear.
The last field in the form must be the file field corresponding to the file to be uploaded, and the field name must be equal to the uploadKey.
The form action must be equal to the uploadUrl.
The form method must be equal to the uploadMethod.
An html form for the above example might look like this:HTML
If a File property has been updated, but the user logs out or cannot otherwise complete the upload within a period of time, the upload window may expire. Without having to reset the file property, facet uploads can be refreshed, to produce new upload information that can be used to initiate or continue an upload. To do so, update the file property directly with a refresh parameter. The json body must contain the facet names of the target uploads, and the response will contain an array of uploads that were refreshed.Example