[wp-edu] managing Upload Filetypes on WordPress 3.x.x

Whisler, Dave dkwhisle at uncc.edu
Thu May 10 20:43:53 UTC 2012


I followed the directions in that weblink and it works perfectly.   Thanks!    
Is there any way to put a weblink to this page on the doc page about file uploads (http://codex.wordpress.org/Uploading_Files) so it's easier to find?

Dave
-----Original Message-----
From: wp-edu-bounces at lists.automattic.com [mailto:wp-edu-bounces at lists.automattic.com] On Behalf Of Muro, Matthew
Sent: Thursday, May 10, 2012 4:01 PM
To: wp-edu at lists.automattic.com
Subject: Re: [wp-edu] managing Upload Filetypes on WordPress 3.x.x

You do not and should not have to edit the core to add or remove a mime type.  Use the filter upload_mimes.

http://codex.wordpress.org/Plugin_API/Filter_Reference/upload_mimes

Matthew Muro
Web Developer
UA Office of Web Communications





On May 10, 2012, at 2:58 PM, Whisler, Dave wrote:

Joseph,

I just looked at wp-includes/functions.php (part of core) and the "get_allowed_mime_types" function is what is determining which file types are acceptable or not.
       .accdb is NOT listed in this function, but .mdb is listed in it.
This is why I cannot upload a .accdb file into WP, but I can upload a .mdb file.

So, even in the single-install of WordPress, the acceptable file types to upload are limited and not easily updated (out of the box).
It appears that either you have to edit wp-includes/functions.php (part of core)  and add/remove file types from the "get_allowed_mime_types" function or you have to use one of the WP plugins (or write your own) to manage the list of allowed file types to upload into WordPress.

On one of my multi-site installs, I could not upload the .accdb, nor could I upload the .mdb file.
So, I added the mdb and accdb file formats to the "Upload file types" item in the Upload Settings area of multisite network settings.
Afterwhich I could go into one of the sites in this network and upload the .mdb BUT NOT the .accdb file.
Hmmm....   It appears that on a multisite the filetype must be in the "get_allowed_mime_types" function of the wp-includes/functions.php file AND in the "Upload file types" list.

In reply to your email below:

The goal is to be able to easily add (or remove) file types from the list of file types that can be uploaded into WordPress.  I need this ability for single-site installs as well as multisite installs.   I don't want to have to edit the core functions.php file (listed above), because then it becomes a maint. issue when applying WordPress upgrades/patches.

Does anyone have advice?

Thanks,
Dave

David K. Whisler | Oracle & MySQL DBA/Developer, WordPress & Joomla Administrator UNC Charlotte | The William States Lee College of Engineering
9201 University City Blvd. | Charlotte, NC 28223
Phone: 704-687-3964 | Fax: 704-687-2352
dkwhisle at uncc.edu<mailto:dkwhisle at uncc.edu> | http://www.uncc.edu
---------------------------------------------------------------------------
If you are not the intended recipient of this transmission or a person responsible for delivering it to the intended recipient, any disclosure, copying, distribution, or other use of any of the information in this transmission is strictly prohibited. If you have received this transmission in error, please notify me immediately by reply e-mail or by telephone at 704-687-3964. Thank you.


-----Original Message-----
From: wp-edu-bounces at lists.automattic.com<mailto:wp-edu-bounces at lists.automattic.com> [mailto:wp-edu-bounces at lists.automattic.com] On Behalf Of Joseph Ugoretz
Sent: Thursday, May 10, 2012 3:33 PM
To: wp-edu at lists.automattic.com<mailto:wp-edu at lists.automattic.com>
Subject: Re: [wp-edu] managing Upload Filetypes on WordPress 3.x.x

Weird indeed and you may have me stumped, but maybe some of the more expert folks on the list can help.

But just to clarify...

What you want to do is to be able to use the "Upload file types" item in the Upload Settings area of multisite network settings to add or subtract filetypes?

Is that right?

I guess I'm not certain what the goal is here--to have this work in single-site (standard) or multi-site?

I can vouch for the fact that it does (or should) work in multi-site.  So I'm not sure how the different behavior in single-site really helps?


--
Joseph Ugoretz, PhD
Associate Dean of Teaching, Learning and Technology Macaulay Honors College - CUNY
35 West 67th St.
New York, NY 10023
212.729.2920
http://macaulay.cuny.edu






On May 10, 2012, at 3:23 PM, Whisler, Dave wrote:

Joseph,

Ok, so I tried what you said in a regular install of WordPress 3.3.2 (latest version - not configured for multisite).
I was not able to upload a MS-Access 2007 db file (.accdb) which I created just for this test (just has one table in it with a couple of records...).
However, when I renamed the file to the old MS-Access 2003 db file extension (.mdb file format), then WordPress allowed me to upload it.

Weird, huh?

David K. Whisler | Oracle & MySQL DBA/Developer, WordPress & Joomla Administrator UNC Charlotte | The William States Lee College of Engineering
9201 University City Blvd. | Charlotte, NC 28223
Phone: 704-687-3964 | Fax: 704-687-2352
dkwhisle at uncc.edu | http://www.uncc.edu
---------------------------------------------------------------------------
If you are not the intended recipient of this transmission or a person responsible for delivering it to the intended recipient, any disclosure, copying, distribution, or other use of any of the information in this transmission is strictly prohibited. If you have received this transmission in error, please notify me immediately by reply e-mail or by telephone at 704-687-3964. Thank you.


-----Original Message-----
From: wp-edu-bounces at lists.automattic.com [mailto:wp-edu-bounces at lists.automattic.com] On Behalf Of Joseph Ugoretz
Sent: Thursday, May 10, 2012 12:36 PM
To: wp-edu at lists.automattic.com
Subject: Re: [wp-edu] managing Upload Filetypes on WordPress 3.x.x

Hi Dave,

As far as I've seen, that limit on uploaded file types is specific to multisite, not configurable in standard, because the possible security problem of untrusted (or less-trusted) users doesn't exist in single-user WordPress.  If you're the single user, it can be assumed that you trust yourself.

In multisite, though, that option does work fine.  WordPress does utilize it, without any plugins, or at least it always has in our install.  We can add new file types to that list, and files of that type can then be uploaded.  Or conversely, when we remove file types from that list, they can no longer be uploaded.

So if that's not working for you, there must be something else wrong.  Maybe php settings?

If everything's functioning as it should, as it's designed to, that list of acceptable file types is workable and effective.

Joe

--
Joseph Ugoretz, PhD
Associate Dean of Teaching, Learning and Technology Macaulay Honors College - CUNY
35 West 67th St.
New York, NY 10023
212.729.2920
http://macaulay.cuny.edu






On May 10, 2012, at 11:21 AM, Whisler, Dave wrote:

I need to know the best way to add/remove items from the list of acceptable file types (file extensions) that are permitted in WordPress 3.x.x.

Standard WordPress (non-multisite):  It does not have any options to add/remove file from the WP Dashboard.
WP MultiSite Installation:  If you go into the network admin Dashboard, it has a field that has a list of acceptable file types here:   Dashboard -> Settings -> Network Settings ->  "Upload file types".   However, adding a new file type to this list does not seem to enable me to upload a file of this type to any of the sites on this WP network.    What am I missing?

Why would WordPress have this option listed in the Network configuration on Multisite installations and then not utilize it?     And where is this option on a normal WordPress install?

The online WordPress codex seems to be silent on this:    http://codex.wordpress.org/Uploading_Files

1.       What is the correct way to accomplish this?
2.       And if it cannot be accomplished without using (or writing a plugin), let me know which Plugins you have used and why.   Below are some plugins that I found (not tested yet) that seem like they might accomplish this.   Does anyone have experience using them on a WP multisite network?    A major concern is that I do not want to be able to set them network-wide - and not have to do any configuration changes on individual sites.

Below are some Plugins that appear like they might do the job.
http://wordpress.org/extend/plugins/ap-extended-mime-types/

http://wordpress.org/extend/plugins/manage-upload-types/

http://wordpress.org/extend/plugins/add-more-files-extensions/

http://wordpress.org/extend/plugins/uploads/


In the database for WP Multi-sites, you can run this query to see the same list of upload filetypes as in the Network Settings:
SELECT meta_key, meta_value FROM wp_sitemeta WHERE meta_key="upload_filetypes"; However, I've not found anything like this on a single-site WordPress installation.

Some people suggest modifying the function.php file in your WordPress theme to do it.   While others have said to modify WordPress core (wp-includes/functions.php - add the filetypes in the "get_allowed_mime_types() function).   However, I'd rather not modify my theme (what if we want to change themes?) or WordPress core (what about upgrades) - as this just adds complications.

Please let me know how you accomplish this - as I want to best method for the long-run - one that won't end up causing problems in the future.

Thanks,
Dave

David K. Whisler | Oracle & MySQL DBA/Developer, WordPress & Joomla Administrator UNC Charlotte | The William States Lee College of Engineering
9201 University City Blvd. | Charlotte, NC 28223
Phone: 704-687-3964 | Fax: 704-687-2352
dkwhisle at uncc.edu | http://www.uncc.edu
---------------------------------------------------------------------------
If you are not the intended recipient of this transmission or a person responsible for delivering it to the intended recipient, any disclosure, copying, distribution, or other use of any of the information in this transmission is strictly prohibited. If you have received this transmission in error, please notify me immediately by reply e-mail or by telephone at 704-687-3964. Thank you.

<ATT00001.c>

_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-edu
_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-edu

_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-edu
_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-edu

_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-edu


More information about the wp-edu mailing list