let mediaURLLoop = 0
let fileUploaded = false
$w.onReady(function () {
});
export function uploadMediaFilesObject_change(event) {
if ($w("#uploadMediaFilesObject").value.length > 0) {
$w('#buttonSubmitForm').disable()
$w('#uploadMediaButton').enable()
fileUploaded = false
} else {
$w('#buttonSubmitForm').enable()
$w('#uploadMediaButton').disable()
}
}
export function uploadMediaButton_click(event) {
$w("#uploadMediaFilesObject").uploadFiles()
.then((uploadedFiles) => {
uploadedFiles.forEach(uploadedFile => {
const currentURLBox = `#inputMediaURL${mediaURLLoop}`;
$w(currentURLBox).value += "https://static.wixstatic.com/media/" + uploadedFile.fileName
console.log('File url:', "https://static.wixstatic.com/media/" + uploadedFile.fileName);
mediaURLLoop += 1
})
console.log("Done")
$w('#uploadMediaFilesObject').disable()
$w('#buttonSubmitForm').enable()
$w('#uploadMediaButton').disable()
})
.catch((uploadError) => {
let errCode = uploadError.errorCode; // 7751
let errDesc = uploadError.errorDescription; // "Error description"
});
}