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
  • 0
    Certified Lead Developer

    This message appears because the PDF file type is blocked in the Admin Console under 'File Upload' using file extension blocking settings. The error will remain visible until the user manually refreshes or interacts with the interface; it does not clear automatically. One solution is to allow the file type at the admin level and then apply your own field-level validation in the interface(Make sure to create generic file upload to have consistency)

  • 0
    Certified Associate Developer
    in reply to Shubham Aware
    Hi! Thanks for your quick response, but I don't think that's the entire problem. If I upload a file that was originally a .pdf, it doesn't show this error, only my validation message. The problem lies in manually changing the file extension. If it was originally an .xlsx and I changed it to .pdf, it seems to become "corrupted" and the metadata doesn't match. It may have something to do with the administration, but I don't have access to it. However, .pdf files are accepted because they are attached elsewhere in the application. Thanks again. 
Reply
  • 0
    Certified Associate Developer
    in reply to Shubham Aware
    Hi! Thanks for your quick response, but I don't think that's the entire problem. If I upload a file that was originally a .pdf, it doesn't show this error, only my validation message. The problem lies in manually changing the file extension. If it was originally an .xlsx and I changed it to .pdf, it seems to become "corrupted" and the metadata doesn't match. It may have something to do with the administration, but I don't have access to it. However, .pdf files are accepted because they are attached elsewhere in the application. Thanks again. 
Children