• Resolved kengholm

    (@kengholm)


    Hi,
    While new editors were being trained yesterday, sometimes the files they selected appeared to be accepted and there was no error given when they submitted their post, but in the resulting draft post, there was no Featured Image. So the website admin doesn’t know there was supposed to be an image and the submitter doesn’t know their image is missing. I was unable to find out what kinds of images failed.
    A 1.7M jpg works fine when I test it now. Maybe the files that failed were too big or the wrong kind, but they should have given some error indication.
    I can find no specification for the filetypes allowed for Featured Image in PostData field, nor a way to limit file type or size.
    Please tell me the requirements for the Fetaured Image upload so I can add this to the Description field on my form.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @kengholm

    I tested that on a site of mine and when filesize is larger than the upload limit or the filetype is not supported, then the form can’t be submitted and it returns an error message (“An error occurred processing the form. Please try again”).

    Could you please export your form so we can review it?
    Here’s how: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export
    Please use a service like Pastebin or Dropbox than pasting the whole JSON file here. ??

    Thank you,
    Dimitris

    Thread Starter kengholm

    (@kengholm)

    Thanks Dimitris,
    Here is the Pastebin link: https://pastebin.com/tT9U4fkN
    Can you please tell me the size limit and allowed file types? They aren’t in the documentation and I can’t test without knowing the limits.
    I attempted to upload a medium-sized PDF a little while ago using the Featured Image upload child control in the PostData field on this form. The “submitting” spinner has been turning for 15 minutes. The Notification email has not been sent.
    Kathy

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    Thank you for the form.

    For the featured image the plugin won’t add any specific limit, but you can verify the WordPress max upload size and max post size to make sure the limit is not from WordPress itself.

    For the upload field, it does have the option to limit the upload, in case it hangs in the sending, can you try the Ajax option?

    https://monosnap.com/file/404fRmgO4Bhqp0NZLUgJ25wIchXJUX

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Thread Starter kengholm

    (@kengholm)

    Hi Patrick,
    Thank you for the info on the Feature Image in PostData. My WP limit is large because we need that for internal use. I would really like to set a much smaller limit for user-submitted images, partly because they are often unaware of what size images they have and partly because of the possibility of getting spammed with huge files.

    Please can you tell me if the **accepted** filetypes that can work for Featured Image in PostData are the same as the “Images” list for the regular File Upload field. It **allows** all the file types I have tried. The File Upload dialog for the Upload button in the PostData field says “All Files (*.*)” and does not warn the user if they submit a type that won’t work. It shows the “submission successful” message. It also does not warn the staff who receives the notification email that an upload was attempted and failed. The Featured Image is just empty in the created post. I sent a 1MB pdf just now, the form submission said it was successful, (no infinite wait), and the Featured Image was empty in the post.
    It should not accept filetypes that it can’t handle.

    It is possible there is a conflict with PopupMaker, but I can’t test without PopupMaker because my Forminator forms are not visible on the website when I place them directly in a post or page. The only way they work is in a popup. The site is live so I’ll have to create a staging site before I do more in-depth testing if that is needed for your investigation.

    I have been using the Upload field successfully in the past and do limit the filesize for that field. I am using the Ajax option now. I have no troubles with this field.
    Kathy

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    It makes sense, the featured image should only allow image files.

    I checked the Forminator code and I see some verification for this in the code which should prevent other types of files.

    I made some tests and could see some issues on the front end allowing me to select any time and size.

    Can you please try this code as a mu-plugin?

    <?php
    
    add_filter( 'forminator_field_postdata_markup', 'features_limit_file_type_wpmu', 20, 4 );
    
    function features_limit_file_type_wpmu($html, $field, $required, $id){
    
    	$html = str_replace('type="file" name="postdata-1-post-image"', 'type="file" multiple accept="image/*" name="postdata-1-post-image"' , $html);
    
    	return $html;
    
    }

    This won’t limit the file size but at least does a bit of front end validation on upload.

    I’m going to report to the plugin developers so we can improve it on the plugin side.

    In case you are not familiar with mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Let us know if the code helped to prevent some unexpected file formats.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional question or problem.

    Best Regards
    Patrick Freitas

    Thread Starter kengholm

    (@kengholm)

    Hi Patrick,
    I’m sorry I was unresponsive; I was busy launching the site and dealing with other issues.
    I took this out of Resolved state because the filter you provided does not prevent spreadsheets, source code, or other files from being selected (not a surprise) and it still allows the submission to proceed and shows user the message for successful submission. No error to user; no error reported in the notification email… no Featured Image and neither submitter or recipient knows there was a problem.
    I know that the filter runs because I added an echo statement to display the field ID to verify that the filter is executed.
    I tried changing “Multiple” to “single” and also simply removing it because only one file should be accepted for Featured Image. The result in every case was that the PostData field works fine for image files but proceeds with no warning and no file for other filetypes.
    We expect this to be a significant problem because many of our users are not experienced with computers and files and they frequently attempt to submit invalid files in other situations where we have working checks and warnings.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    Thank you for the update.

    This is odd, it should prevent any file other than the image for the featured image and for the regular upload you can manage in the plugin interface.

    Do you still use the same version of https://pastebin.com/tT9U4fkN or had modified the form?

    Let us know this information and we can run some more tests.
    Best Regards
    Patrick Freitas

    Thread Starter kengholm

    (@kengholm)

    Hello Patrick,
    I deleted that paste because it showed my email and website addresses and the Pastebin link is exposed in earlier messages above. Is there a secure way I can send you a new link to the current version of the form, or a password to a private Paste, rather than showing it here?
    Thanks,
    Kathy

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    Yes, please, send it to:

    [email protected] using this template:

    Subject: “Attn: Patrick Freitas”

    Message: link back to this thread for reference

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    Thank you for the form.

    Could you double-check if the file was added as a mu-plugin correctly?

    It must be inside the mu-plugins folder, if you don’t have this folder you can create it.

    The filter is not a perfect solution indeed as could be easily bypassed and I already reported it to our developers.

    It adds an extra verification in the HTML and only allows the user to upload images, I tried to upload an excel file but it doesn’t allow me to select the file.

    https://monosnap.com/file/BnYI1NbthcDVIcM34GzZgOC9gzNbpv

    https://monosnap.com/file/iXED996gdMDr7VCeD9wiy4uUTS3ymq

    Best Regards
    Patrick Freitas

    Thread Starter kengholm

    (@kengholm)

    Hello Patrick,
    Thank you for your message.
    1) I know the filter file is working properly as an mu-plugin: It is in the mu-plugins folder under the wp-content directory. Further, I added an echo statement in the function that prints “ECHO” to the display as you can see in this screen image, plus the selected excel file in the upload field, and the Element Inspector view of the html. https://www.pnwglassguild.org/postdata-screenshot/
    2) I don’t know what to do with the image in your link https://monosnap.com/file/BnYI1NbthcDVIcM34GzZgOC9gzNbpv. I don’t recognize those files.
    3) How do you know it “doesn’t allow me to select the file”? When I fill the form and select an excel file in the postdata upload field, it does not OFFER me any files except images, but I can select All Filetypes from the file-select dialog and it takes the excel file into the postdata filename field. When I submit the form, it shows the Success message. The file is not included in the notification email or the post, but there is no error message. What is the behavior when you select an excel file?
    Thanks, –Kathy

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    The image is from my computer to show that I can’t select other files rather than images files.

    Could you please send your form URL and we can check from your website too?

    3) How do you know it “doesn’t allow me to select the file”?

    When having that HTML the browser PopUp would block the files greying out the not allowed files.

    Best Regards
    Patrick Freitas

    Thread Starter kengholm

    (@kengholm)

    Hi Patrick,
    Can you give a link to the image from your computer?
    Here is the form URL: https://www.pnwglassguild.org/test-form-to-post/
    Thank you.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @kengholm

    Thank you for the link,

    I did a closer look at this and was able to replicate it when we switch to All type, as I told you, it is easy to bypass.

    I tried some extra JavaScript validation but made no difference.

    I pinged the plugin team to verify if there is any extra code that we can attempt.

    We will update once hearing back from the team.

    Best Regards
    Patrick Freitas

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘PostData field > Featured Image: not uploaded but no error shown’ is closed to new replies.