Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ----------------------------------------------------------
- Plugin Name: Extended Mime Types
- Plugin URI: http://blog.tahlequah.k12.ok.us/maxwellja
- Description: Extends the allowed uploadable MIME types to include a WIDE range of file types. Created specifically for WPMS to allow a wider range of file types network-wide.
- Version: 1.0
- Author: Josh Maxwell (Tahlequah Schools)
- Author URI: http://blog.tahlequah.k12.ok.us/maxwellja
- ----------------------------------------------------------
- */
- // Add the filter
- add_filter('upload_mimes', 'tqps_extended_mime_types');
- // Function to add mime types
- function tqps_extended_mime_types ( $mime_types=array() ) {
- // add your extension & app info to mime-types.txt in this format
- // doc,doct application/msword
- // pdf application/pdf
- // etc...
- $file = '/extended-mime-types/mime-types.txt';
- $file = plugins_url() . $file;
- $mime_file_lines = file($file);
- foreach ($mime_file_lines as $line) {
- //Catch all sorts of line endings - CR/CRLF/LF
- $mime_type = explode(" ",rtrim(rtrim($line,"\n"),"\r"));
- $mime_types[$mime_type[0]] = $mime_type[1];
- }
- // add as many as you like
- return $mime_types;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement