How do I solve this, the upload button code does not work on my site

Try this:

export async function button_click(event) {
    if ($w('#uploadButton').value.length > 0) {
        $w('#button').label = 'Uploading...'
        const upload = await $w('#uploadButton').uploadFiles()
        console.log(upload)
    } else {
        $w('#text2').text = 'Please choose a file to upload.'
    }
}