bp_document_ajax_check_file_mime_type()
Description
Source
File: bp-core/admin/bp-core-admin-functions.php
function bp_document_ajax_check_file_mime_type() {
$response = array();
if ( isset( $_POST ) && isset( $_POST['action'] ) && 'bp_document_check_file_mime_type' === $_POST['action'] && ! empty( $_FILES ) ) {
$files = $_FILES;
foreach ( $files as $input => $info_arr ) {
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $info_arr['tmp_name'] );
$info_arr['type'] = $real_mime;
foreach ( $info_arr as $key => $value_arr ) {
$response[ $key ] = $value_arr;
}
}
}
wp_send_json_success( $response );
}
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.