Add new extensions to the uploader

This topic contains 7 reply and 2 voices, and was last updated by Pierre-Yves 10 years, 7 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
August 2, 2013 at 8:28 pm 6604
Pierre-Yves 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!
August 3, 2013 at 1:19 am 6611
Tareq Hasan Tareq Hasan

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]

August 5, 2013 at 3:23 pm 6652
Pierre-Yves Pierre-Yves

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

August 7, 2013 at 2:00 pm 6707
Pierre-Yves Pierre-Yves

Hi,

Any idea for my problem?

Thanks

August 8, 2013 at 4:55 am 6728
Tareq Hasan Tareq Hasan

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]

August 8, 2013 at 2:53 pm 6752
Pierre-Yves Pierre-Yves

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?

August 8, 2013 at 6:34 pm 6757
Tareq Hasan Tareq Hasan

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

August 8, 2013 at 8:54 pm 6761
Pierre-Yves Pierre-Yves

It works now 🙂

Thank you Tareq.

Viewing 7 Posts - 1 through 7 (of 7 total)