File Upload element rejects .EML files

Home Forums Quform WordPress File Upload element rejects .EML files

This topic is: resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #26613
    katw
    Participant

    I have a file upload element with .eml defined as an allowed file extension.

    The mime type for .eml is message/rfc822.

    Despite the extension being list as “ok” I cannot upload an EML file. On submit the error is: File type of 'sample.eml' is not allowed.

    The initial error was “unrecognized format”; which was resolved by adding a new MIME entry in .htaccess

    Ideas?

    Is there a “blacklist” of unsafe filetypes and can I put an exclude for this one?

    #26625
    katw
    Participant

    I did some code digging and see your routines (rightly) use the ‘allowed’ MIME file list in the WP core.

    So solution is to add ‘EML’ to permitted list by either:

    Adding a Plugin – e.g WP Add Mime Types

    OR

    Functions.php code insert:

    function my_theme_custom_upload_mimes( $existing_mimes ) {
    	// add EML to the list of mime types
    	$existing_mimes['eml'] = 'message/rfc822';
    	// return the updated array
    	return $existing_mimes;
    }
    add_filter( 'mime_types', 'my_theme_custom_upload_mimes' );

    Shared for others… who may have a similar situation

    #26626
    katw
    Participant

    Unfortunately, the problem was not solved by adding the mime type to the WP_mime_list.

    I check it was added by var_dump(wp_get_mime_types()). I can confirm it was added.

    After doing this, I am now seeing the error message: not in a recognised format.

    Which has changed.. but one I had seen before I added the EML MIME type to .htaccess.

    I again checked .htaccess to ensure my addtype entry was present. Yes

    I also tried a different browser for upload.

    Sample EML file attached for your testing. Please delete this file once you get it. Thanks

    #26627
    katw
    Participant

    Yep, the message at footer above sums up my feeling too… ahh.

    BTW the error message “not in a recognised format” occurs upon choosing the file; not at form [submit].

    So Quform hasn’t checked the servers modified MIME approval list at form initialisation is my guess.

    • This reply was modified 5 years, 8 months ago by katw. Reason: add more info
    #26676
    katw
    Participant

    I see in plugin settings an override for allowing risky file types “Allow uploading all file types”.

    I want to expand the “allowed” to include EML but keep other risky types away; so I haven’t activated this option.

    Will wait to hear from you.

    #26692
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #26710
    katw
    Participant

    Could it be coming from the ADVANCED UPLOAD component as this is enabled for this field.

    The error is front-end generated (before submit).

    Hence the advanced upload item I have pointed out.

    I will poke around.

    You can test it at: contact form

    #26722
    katw
    Participant

    The message text “Not a recognised format” was the text replacement for the “File not allowed” error message.

    Close ticket.

    It is working and supporting EML now. Perhaps my MIME entries hadn’t propagated. All good now.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy