Use filter ‘upload_mimes‘.
<?php
add_filter('upload_mimes','add_java_files');
function add_java_files($mimes)
{
// Add file extension 'extension' with mime type 'mime/type'
$mimes['java'] = 'text/x-java-source';
return $mimes;
}
Related Posts:
- Limit image upload to one and disable audio, video and other document file types to upload
- what happens to existing media files when I switch to year/month directory structure format?
- Media upload finished hook
- How can I batch delete all unattached images with WP-CLI or other automated process?
- Image upload callback in new 3.5 media
- How to wp_upload_bits() to a sub-folder?
- “Add Media” only shows “Full Size” under Attachment Display Settings
- Differentiate Featured Image from Post Images upon Upload
- What might cause a POST to wp-admin/async-upload.php to return JSON >and< HTML?
- Is it possible to trigger some JavaScript when Media Popup is opened?
- What permissions does wp-content/uploads need?
- wp_handle_upload() – how to upload to a custom subdirectory within uploads
- There’s a way to scale media (images) at 50%?
- How to Reduce the Maximum Upload File Size?
- Media Uploader: get deleted files
- How can I prevent uploading bmp image?
- how to upload mp3 from url to wp media
- How to get the image url in the input box from media library?
- WordPress upload file – get path to WordPress installation
- Issue on Running Image upload on WP Metabox Custom Image Loader
- Select image sizes you want to be uploaded
- Check if image exists before uploading with media_sideload_image()
- Plugin to Import Dropbox Files into Media Folder from the Cloud [closed]
- Disable gallery in 3.5 media iframe
- Extend the list of MIME-types supported by the builtin uploader in 3.3
- Setting higher upload limit
- What error logs can I check to see why plugin updates are failing?
- WordPress won’t generate image sizes for certain images
- Resize the WP media Uploader iFrame
- How can I reduce file upload size?
- WordPress HTTP Error on File upload
- Images not being generated at correct size
- Remove attachment fields from custom media uploader
- Custom “Insert into Post” button
- How to use MediaUpload outside of editor
- Switch between tabs on “Insert Media” dialog
- Site running slow on new server?
- update_options and unique filenames
- REST API: upload media with advanced custom fields (ACF)
- Prevent a folder from being shown within the media library
- async_upload.php 500 Error when Uploading larger files with slow internet connection and latency
- Is It Possible to Upload Certain Attachment Files To A Remote Server
- WordPress Issue : The uploaded file could not be moved to wp-content/uploads/
- After moving from complete AWS setup to a standalone WordPress Server, Media/Image Files are Broken
- Duplicates and other problems in Media Library
- “send_to_editor” function returning pdf file name
- WordPress Media frame pre load images from ids
- How to allow logged out users to upload media?
- Choosing images size when uploading
- File Upload from Frontend
- Easing the download of a regularly uploaded pdf
- Get all images in uploads directory and list them
- WordPress Bug on IIS ? Problem when uploading image on IIS 7
- Upload mime types for ai illustrator file
- upload_max_filesize in .user.ini Not Reflected in Media Upload
- Is it possible to import all files from a uploads DIR into WP media, retaining paths to the files
- How to resize attachement
- How does WordPress decides how many sizes of an image to create?
- Big file upload give HTTP error
- Organizing uploaded Media in permalink-based folder structure?
- Offload Media Library to other domain on a different server
- What functions of WP_Filesystem allow me to create a file with code-generated contents in a directory?
- Image upload to media library fails. Folder won’t create, database insert fail, XAMPP Windows
- Right way to download file from source to destination
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Incorrect filenames in load-scripts.php parameters
- wordpress upload permission on nginx & ubuntu
- Embed HTML5 files/subfolders in post?
- How to change archieve frequency of the media file in uploads folder for wordpress blog
- Insert attachments from custom uploader into post (regular uploader style)
- How to download CSV from sub directory in uploads folder
- Import media (.xml) does not attribute featured images to posts
- Blog suddenly can’t display .jpg
- Upload multiple files
- wordpress Do not show new image attachment in media
- Modify Maximum upload file size text in WordPress Media
- Manipulate the files uploaded via Gravity Forms before they are stored
- Replicate Media Galley Edit view in Add Media View
- Front-End Upload media with category
- Sanitizing existing media library paths and page links from foreign characters
- Cannot upload png photo files into media library. I get a ‘Could not insert post into the database’
- Do audio files impact the loading time of the website?
- File upload in WordPress
- Set default “Link CSS Class” in add media admin editor
- How to change default upload dir?
- How could you allow users to upload a video in within their profile and display it on a wordpress site?
- 45mb File Exceeds the Maximum Execution Time
- How to share media between independent blogs?
- WP Capabilities to Add Media, Use Media, But Not Edit Them
- Limit attachment caption characters
- Password protected uploaded PDF page
- CSS updates appear after delay [closed]
- Why isn’t my enqueuing working properly?
- What is the best way to upload a temporary & sensitive file and then delete it when done
- How do I allow family commenters to upload photos?
- Do I need FTP set up to upload files to wordpress server
- Media Gallery doesn’t show (using WP-Read Only)
- Problem uploading files, after changing domain name
- Unable to upload images using the Media Library
- Create media folder upon post publish?