Home › Forums › Quform WordPress › File Upload element rejects .EML files
- This topic has 7 replies, 2 voices, and was last updated 6 years, 8 months ago by
katw.
- AuthorPosts
- August 10, 2018 at 11:07 am #26613
katw
ParticipantI 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?
August 11, 2018 at 5:04 am #26625katw
ParticipantI 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
August 11, 2018 at 5:05 am #26626katw
ParticipantUnfortunately, 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
August 11, 2018 at 6:01 am #26627katw
ParticipantYep, 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 6 years, 8 months ago by
katw. Reason: add more info
August 15, 2018 at 1:10 pm #26676katw
ParticipantI 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.
August 16, 2018 at 9:41 am #26692Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
August 16, 2018 at 11:29 pm #26710katw
ParticipantCould 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
August 18, 2018 at 2:21 am #26722katw
ParticipantThe 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.
- This reply was modified 6 years, 8 months ago by
- AuthorPosts
- You must be logged in to reply to this topic.