Name of the file to upload, has to contain an extension.
Data-URL of the file in base64
Optional
overwrite: boolean = falseSet to true
to overwrite an existing file, otherwise false
. (Default: false
)
Returns a promise which can either fail (string
with reason) or succeed (string
with URL to file)
When the API has not been properly configured using configure, an exception is thrown detailing the missing information.
The example below will get the Data-URL from a file-input and upload it as "test.png".
import { api, utils } from "@hboictcloud/api";
try {
const data = await utils.getDataUrl(document.querySelector("#fileUpload"));
const uploadResponse = await api.uploadFile("test.png", data.url);
console.log(data, uploadResponse);
}
catch(reason) {
console.log(reason);
}
Generated using TypeDoc
Upload a file to the uploads-folder on the configured HBO-ICT.Cloud environment