0

How can I allow .bin files upload in media library?

I have found couple codes online but none of them actually work.

  • Have you tried WP Extra File Types? It comes highly recommended and appears to be actively developed. – janh Dec 4 '17 at 8:51
1

This code would allow you to upload .bin files.

/**
 * Allow upload bin mime type
 */
add_filter( 'upload_mimes', 'wpse_287673_allow_upload_bin_mime_type', 1, 1 );

function wpse_287673_allow_upload_bin_mime_type( $mime_types ) {

  $mime_types['bin'] = 'application/octet-stream';

  return $mime_types;
}

This code is tested and is working for me, but it might be some differences for you since we are allowing files to be uploaded by extension and mime type and mime type of your file is defined by webserver.

  • Thanks for the code, it works. I've used similar code that I've found online but it didn't work, but your does :). Thanks a bunch! – David Dec 4 '17 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.