Upload multiple files on one upload button

Hi there, here is the solution that we built for one of our clients allowing a user to upload as many images desired with one single upload field. We prefer to avoid call back hell so we use async await.

 
let workImages = [];

export async function uploadWork_change(event) {
 let greenFlag = false;
 let file = $w('#uploadWork').value;
 if(file.length > 0){
 let response = await $w('#uploadWork').startUpload($w('#uploadWork').buttonLabel = 'Uploading ...');
        greenFlag = response;
 if(greenFlag){
            workImages.push(response.url);
            greenFlag = false;
            console.log(workImages, file[0].name);
            $w('#uploadWork').buttonLabel = 'Add another picture'
            $w('#uploadedTxt').expand();
            $w('#uploadedTxt').text = `Done, Uploaded ${file[0].name}`;
        }
    }
}