Skip to main content
sivasuryap0002
November 6, 2021
Question

a!fileUploadField

  • November 6, 2021
  • 5 replies
  • 0 views

I am using a!fileUploadField in my interface and its not showing any error when I am editing in expression Mode but when i change it to designer mode its showing error.

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!fileUploadField [line 78]:

                    a!fileUploadField(
                        label: "Upload An Image :",
                        labelPosition: "ABOVE",
                        target: cons!CS_DOCUMENT_FOLDER,
                        fileNames: fv!files.name: local!registratioNo,
                        fileDescriptions: "This is the uploaded file for the vehicle : " & local!registratioNo,
                        maxSelections: 1,
                        value: local!file,
                        saveInto: {
                          local!file,
                          a!save(ri!Vehicle.UploadedFile, save!value)
                        },
                        required: if((local!required), true(), false()),
                        validations: if(
                          fv!files.extension <> "JPG",
                          "File format is not supported ",
                          if(
                            fv!files.size > 1000000,
                            "File size should not be greater than 1 MB",
                            {}
                          )
                        )
                      )


no Code changes

    5 replies

    andrewh0007
    November 16, 2021

    Are you still having this issue? I copied your code and changed very minimal things and it's working for me so I'm stumped [emoticon:ca08b2c27c2f40e993e89508acf29e0b]

    sivasuryap0002
    November 16, 2021

    Yes,
    Could please tell me what are the changes you made and why.

    andrewh0007
    November 16, 2021

    Ah! Actually, I was getting the same error. And very weird!

    It can be solved by putting an or() around your size validation as the fv!files property is an array even though you have a max selection of 1.

    Technically your check on the file extension should also use the or() although being a string it seems to handle it.

    Very weird though.

    if(
      or(fv!files.extension <> "JPG"),
      "File format is not supported ",
      if(
        or(fv!files.size > 1000000),
        "File size should not be greater than 1 MB",
        {}
      )
    )