• Daniel Ruyter

    (@dbruyteryahoocom)


    Great plugin and really appreciate your support.

    How do I use the short code [fu-upload-response] to display messages when a disallowed mime type has been uploaded?

    I’m restricting to only jpg & png, but when I try to upload a PDF as a test, it still takes me to the “Success” page, but the URL indicates an error response. How do I display an error message instead of the “Success” page? Here’s my shortcode:

    [fu-upload-form title="Submit Your Photo to (website)" form_layout="post_image" category="33" success_page="https://www.mywebsite.com/thank-you/"]
    [input type="text" name="post_title" id="title" class="required" description="Give the photo a title."]
    [textarea name="post_content" class="textarea" id="ug_caption" description="Tell us about your photo (optional)."]
    [input type="file" name="photo" id="ug_photo" class="required" description="Attach your photo (or use your mobile phone camera to take one)." multiple="multiple"]
    [input type="submit" class="btn" value="Submit My Photo!"]
    [/fu-upload-form]

    Note: my version says 0.9.3.

    https://www.ads-software.com/plugins/frontend-uploader/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rinat

    (@rinatkhaziev)

    I think PDF upload is whitelisted in WordPress itself. To explicitly disallow it you’ll need to add following snippet to your theme’s functions.php:

    add_filter( 'fu_allowed_mime_types', 'my_fu_allowed_mime_types' );
    function my_fu_allowed_mime_types( $mime_types ) {
    		// Remove pdf from the list of whitelisted mime types
    		unset( $mime_types['pdf'] );
        return $mime_types;
    }

    Please not, that this will only remove pdf (there’s a bunch of other file types whitelisted by default, see the list here: https://codex.www.ads-software.com/Uploading_Files)

    Thread Starter Daniel Ruyter

    (@dbruyteryahoocom)

    Hi Rinat. Please allow me to clarify that the PDF was not uploaded. So I don’t think I have to explicitly deny document types when I’ve already explicitly allowed image files. I’m just trying to display a message that it failed when it fails and a “success” message when it’s succeeded.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use [fu-upload-response] for errors’ is closed to new replies.