Uploading dwg files to wordpress

Your code should work just fine. The only problem in there is that you’ve set incorrect mime type, I guess…

It should be image/vnd.dwg.

So this one should work:

function custom_upload_mimes ( $existing_mimes=array() ) {
    $existing_mimes['dwg'] = 'image/vnd.dwg';
    return $existing_mimes;
}
add_filter('upload_mimes', 'custom_upload_mimes');