Home Forums Plugin Support WP User Frontend (Free Version) Add new extensions to the uploader

This topic is: resolved

This topic contains 7 replies, has 2 voices, and was last updated by  Pierre-Yves 5 years, 10 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #6604

    Pierre-Yves
    Participant
    Post count: 4

    Hi,

    I've just bought your plugin, it's very cool but I have a question to make it works perfectly with my website.
    I need to create a formular that allow people upload vector files (.ai, .eps…) the problem is those extensions aren't supported by the plugin. Moreover, I checked with my host server, and both of them are supported.

    How can I fix this problem on frontend?

    Thanks in advance!

    #6611

    Tareq Hasan
    Keymaster
    Post count: 2831

    You can add additional file extension support with filters. Paste in your themes functions.php

    [php]
    function wpufe_custom_upload_extensions( $extensions ) {
    $extensions[‘custom'] = array(
    ‘label' => __( ‘Custom Extensions', ‘wpuf' ),
    ‘ext' => ‘eps,ai',
    );

    return $extensions;
    }

    add_filter( ‘wpuf_allowed_extensions', ‘wpufe_custom_upload_extensions' );
    [/php]

    #6652

    Pierre-Yves
    Participant
    Post count: 4

    Hi Tareq,

    Thanks for your quick reply.

    I've tried, to paste the code in functions.php but I have an error message on the top of the website”Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /homepages/1/d459471108/htdocs/wp-content/themes/nomos/functions.php:1113) in /homepages/1/d459471108/htdocs/wp-content/themes/nomos/header.php on line 11″

    and I'm stil not able to upload .ai or .eps files.

    Where should I paste the code exactly?

    Thanks

    #6707

    Pierre-Yves
    Participant
    Post count: 4

    Hi,

    Any idea for my problem?

    Thanks

    #6728

    Tareq Hasan
    Keymaster
    Post count: 2831

    You need to add the code in your themes functions.php, may be at the bottom of that file.

    WordPress doesn't support ai/eps extensions to be uploaded. So you need to make the support too. Below is the full code for extension support, both for plugin and WP:

    [php]
    function wpufe_custom_upload_extensions( $extensions ) {
    $extensions[‘custom'] = array(
    ‘label' => __( ‘Custom Extensions', ‘wpuf' ),
    ‘ext' => ‘eps,ai',
    );

    return $extensions;
    }

    add_filter( ‘wpuf_allowed_extensions', ‘wpufe_custom_upload_extensions' );

    function custom_upload_mimes ( $existing_mimes ) {
    $existing_mimes[‘ai'] = ‘application/pdf';
    $existing_mimes[‘eps'] = ‘application/octet-stream';

    return $existing_mimes;
    }

    add_filter(‘upload_mimes', ‘custom_upload_mimes');
    [/php]

    #6752

    Pierre-Yves
    Participant
    Post count: 4

    Hi Tareq,

    I've pasted the code at the bottom of functions.php, there is no error message anymore but I still can't upload .ai ou .eps files, it doesn't work :'(

    What should I do?

    #6757

    Tareq Hasan
    Keymaster
    Post count: 2831

    There will be a new option (Custom Extensions) will be added in the form editors file upload field. You've to enable it too.

    #6761

    Pierre-Yves
    Participant
    Post count: 4

    It works now ๐Ÿ™‚

    Thank you Tareq.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Add new extensions to the uploader’ is closed to new replies.