How to upload DICOM (dcm) files using wordpress wp_handle_upload?

Viewed 23

I'm using wp_handle_upload to allow users upload .dcm files in the wordpress admin panel, and it does not working fine. I am also using wp_handle_upload to upload other file types ( jpg , pdf , png ) and it's working fine, but it does not work for files with dcm extension. My code is as follows

    $uploadedfile = $_FILES['dicomfile'];
    $upload_overrides = array( 'test_form' => false );
    add_filter('upload_dir', 'my_upload_dir');
    $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
    remove_filter('upload_dir', 'my_upload_dir');

    function my_upload_dir($upload) {

        $upload['subdir'] = '/test' . $upload['subdir'];

        $upload['path']   = $upload['basedir'] . $upload['subdir'];

        $upload['url']    = $upload['baseurl'] . $upload['subdir'];

        return $upload;

    }
0 Answers
Related