The file could not be loaded. Reason: The file extension does not match its underlying type.

Certified Associate Developer
Hi! 
I'm working on version 24.3 with Spanish as the primary language, and I've added a document upload component (a!fileUploadField) to an interface with validation to receive only an XLSX document. I used a file originally with an .xlsx extension and it validates well, but if I manually change the extension to .pdf so it converts, for example, and then upload it, I get an error that I didn't capture in my validation: "File could not be uploaded. Reason: The file extension does not match its underlying file type."
It doesn't actually upload the document, and the error persists even without the attached document. Or if I upload another correct document, I have to refresh the entire page for it to stop appearing.
Is there a way to bypass this validation and just leave the one I have manually, or is there a way to update the validation when a new document is uploaded?


In this part of code, local!excel is not a refresh variable, is just:

localVariables(
local!excel,
...
)


  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Shubham Aware

    From my local desktop, what I do is create a new Excel file, which creates an empty document with an .xlsx extension (for example: test.xlsx):

    • If I attach it like this, everything is fine.
    • If I edit the name from the desktop using Windows Explorer and change the .xlsx to .pdf (or any other extension, I can also use .png; it's just to use the same file by manually changing its extension), the new name would be test.pdf, but it's the same file. So when I upload this same file with its new extension, I get that error message that I don't want, and I have to refresh the page and start over.
    • If I create a new file test2.pdf or any other extension and attach it, the message about my validation appears, not the one in the photo I showed in my question, which is also correct.
  • 0
    Certified Lead Developer
    in reply to Eleeeena1204

    Changing a file extension manually does not alter the actual file content, so Appian blocks uploads when the extension and content don’t match. You cannot upload such files in Appian.