Created
April 7, 2024 09:02
-
-
Save annuman97/be7a38f4b55f8a54f53169613bfb38be to your computer and use it in GitHub Desktop.
Fluent Form File Upload extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('fluentform/file_type_options', function ($types) { | |
$types[] = [ | |
'label' => __('3d files - DWG, STL, STEP, STP, SKP, MAX, FBX, 3DS, IGES, OBJ', 'fluentform'), | |
'value' => 'dwg|stp|stl|STEP|skp|max|fbx|3ds|iges|obj', | |
]; | |
return $types; | |
}); | |
add_filter('upload_mimes', function ($mime_types) { | |
$mime_types ['dwg'] = 'image/vnd.dwg'; | |
$mime_types ['stl'] = 'application/sla'; | |
$mime_types ['step'] = 'application/p21'; | |
$mime_types ['stp'] = 'application/p21'; | |
$mime_types ['skp'] = 'application/x-koan'; | |
$mime_types ['max'] = 'application/x-paperport'; | |
$mime_types ['fbx'] = 'application/x-fortran'; | |
$mime_types ['3ds'] = 'image/x-3ds'; | |
$mime_types ['iges'] = 'model/iges'; | |
$mime_types ['obj'] = 'application/x-tgif'; | |
return $mime_types; | |
}, 1, 1); | |
add_action('fluentform/starting_file_upload', function () { | |
add_filter('fluentform_uploader_args', function ($args) { | |
$args['test_type'] = false; | |
return $args; | |
}); | |
}); | |
//http req | |
add_filter('fluentform/default_file_extensions', function ($mime_types) { | |
$newTypes = [ | |
'application/msword' => 'max', | |
'application/x-fortran' => 'fbx', | |
'application/p21' => 'step', | |
'model/iges' => 'iges', | |
'application/x-koan' => 'skp', | |
'application/sla' => 'stl', | |
'text/plain' => 'obj', | |
]; | |
$mime_types = array_merge($newTypes, $mime_types); | |
return $mime_types; | |
}, 1, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where to add this code in fluent form ?