Skip to main content

upload

File upload

FileUploading.upload(data, fileQuery)

const query = {
type:"page",
entity:"editor",
id:3787,
width:0,
height:0,
compress:true,
}

const value = await FileUploading.upload(data, query)
Schema

data:* File
File objects. Get data as File from your input as e.target.files[0]
example:

fileQuery: IUploadingQuery
Optional set query parameters.
example:

fileQuery.type: string
Type, determines the folder name in the storage
example: page

fileQuery.entity: string
Entity name from which the file is uploaded, determines the folder name in the storage
example: editor

fileQuery.id number
Identifier of the object from which the file is uploaded, determines the folder name in the storage
example: 3787

fileQuery.width number
Optional width parameter.
example: 0

fileQuery.height number
Optional height parameter
example: 0

fileQuery.compress boolean
Optional flag of optimization (compression) for images
example: true

fileQuery.template string
preview template identifier
example: 1

This method uploads a file to a cloud file storage. Pass to the date the value obtained from input type "file".


Data is file object (or array), learn more - File Object

Example return:

[
{
"filename": "string",
"downloadLink": "string",
"size": 0
}
]
Schema

filename: string
filename with relative path

downloadLink: string
link for downloading the file

size number
size of the file in bytes