widgets_manager->register_widget_type( new Custom_Folder_Upload_Widget() ); } add_action( 'elementor/widgets/widgets_registered', 'register_custom_folder_upload_widget' ); // Handle form submission function custom_folder_upload_action() { if ( isset( $_FILES['custom_folder_upload'] ) ) { $file = $_FILES['custom_folder_upload']; $overrides = array( 'test_form' => false ); $upload = wp_handle_upload( $file, $overrides ); if ( isset( $upload['error'] ) ) { // Handle upload error } else { // File uploaded successfully, you can further process it if needed // For example, you can move the uploaded folder to a specific directory } } } add_action( 'wp_ajax_custom_folder_upload_action', 'custom_folder_upload_action' );