File Upload Validate Extension On Button Disabled

I am trying to keep the submit button disabled if they have not selected a file and if the file is not a CSV extension.

The button disable works fine for check for no file but the file extension checking is not working and can not figure out why.

In the below code the first if is working fine but the second one it gets this error   

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'document' [line 45]: The passed parameter(s) are of the wrong type. Received the type Text.   and can not figure out why.  Is there a better way to check this?  Thank you for any help on this, also the ri!csvFile_txt it saves into show this     [Document: 383603]   as the value for it.  The upload also works fine with the csv file as well, just having the issue on the disabled validation part.

primaryButtons: {
      a!buttonWidget(
        label: "Submit",
        submit: true,
        style: "PRIMARY",
        disabled: if(
          rule!APN_isEmpty(ri!csvFile_txt),
          true(),
          if(
            find("CSV", a!fileUploadField(value: upper(document(ri!csvFile_txt, "extension")))) > 0,
            false(),
            true()
          )
        )
      )
    }

  Discussion posts and replies are publicly visible