Perch Forms file upload not accepting file types

  • Hello,


    I have a site where I use Perch Forms with an <perch:input type="file" accept="pdf text richtext office" /> field.


    It works correctly on my staging server - files are uploaded, and only the correct mime types are allowed through. However, on the live server, Perch Forms refuses to allow any file to be uploaded unless I remove the "accept" keyword (i.e. so Perch isn't checking mime types). The form doesn't die or anything, it just echoes an "incorrect file type" error message.


    Perch Debug isn't showing my anything of interest.


    Can anyone please help me diagnose where the problem is? Happy to provide more info if needed.


    Thanks,

    Jon


    (Sorry for the re-post - I couldn't see how to get my original question "live").

  • George G

    Approved the thread.
  • I seem to remember having similar issues a while ago. File upload checking relies on PHP Fileinfo. That may not be enabled on your live server. If you're using hosting on cPanel, Check in PHP Extensions that fileinfo is enabled. This would fit with the behaviour being different on the live and local servers. See:
    https://docs.grabaperch.com/perch/configuration/security/


    This might not be the fix in your case, but perhaps worth checking.

  • I too am having problems with this. A client cannnot upload pdf files into Assets.


    On attempting to upload even a small pdf, there is a response -

    Forbidden

    You don't have permission to access this resource.

    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


    The hosting company say that filieinfo is enabled, and I have php version set to 7.0 for Perch version 3.