Coded form won't submit without selecting file

So I have the below code working for submitting data into the database using a custom form. The one issue I’m having though is sometimes the user will need to submit information without a file. The submit button only works if a file has been selected. How can I change it to submit/insert the information into the database regardless of a file being attached or not?


import wixData from 'wix-data';
import wixLocation from 'wix-location';

export function uploadButton1_change(event) {
 let file = $w("#uploadButton1").value[0].name;
    $w("#fileTitle1").text= String(file);
}

export function submitButton_click() {
 if($w("#uploadButton1").value.length > 0) { 
          $w("#submitButton").disable();
          $w("#submitButton").label = 'Please wait...';
          $w("#uploadButton1").startUpload()
          .then( (uploadedFile) => {
 let fileLocation = uploadedFile.url;
                insertData(fileLocation);
          });
      } else {
          $w("#submitButton").label = 'Please upload file';
      }
}

function insertData(fileLocation) {
 let toInsert = { 
 "repeater_file1": fileLocation,
 "repeaterFile1Title": $w("#fileTitle1").text,
 "repeater_date": $w("#date").value,
 "repeater_title": $w("#title").value,
 "repeater_description": $w("#description").value,
    };
    wixData.insert("Announcements", toInsert)
    .then(() => {
           wixLocation.to("https://www.website.com/announcements");
    });
}