upload
Upload file to oneentry cloud storage.
FileUploading?.upload( file?, fileQuery? );
Minimal example
const fileQuery = {
?"type": "page",?"entity": "editor",?"id": 3787,?"width": 0,?"height": 0,?"compress": true?}
const value = await FileUploading.upload(file, fileQuery)
Schema
file(required): File | Blob
File to upload
example: new File(["content"], "file.png", {"type": "image/png"})
fileQuery: IUploadingQuery
Optional set query parameters
example:
{
"type": "page",
"entity": "editor",
"id": 3787,
"width": 0,
"height": 0,
"compress": true,
"template": 1
}
type(required): string
Type, determines the folder name in the storage.
example: "page"
entity(required): string
Entity name from which the file is uploaded, determines the folder name in the storage.
example: "editor"
id(required): number
Identifier of the object from which the file is uploaded, determines the folder name in the storage.
example: 3787
width: number
Width parameter.
example: 0
height: number
Height parameter.
example: 0
compress: boolean
Flag of optimization (compression) for images.
example: true
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 response
[
{
"filename": "files/project/page/3492/editor/errors-1751677276135-1753090805481.md",
"downloadLink": "https://stage.oneentry.cloud/cloud-static/files/project/page/3492/editor/errors-1751677276135-1753090805481.md",
"size": 4463
}
]
Schema
filename: string
Filename with relative path.
example: "uploads/file.png"
downloadLink: string
Link for downloading the file.
example: "https://example.com/uploads/file.png"
size: number
Size of the file in bytes.
example: 1024