static $file_count = 0; //used to get the current file when multiple uploads in a form
// first make sure its an upload via elementor forms // or you can once again only add this filter hook if you know that this is // a desired form as in the above example if ( false === strpos( $dir, ‘/elementor/forms’ ) ) { return $filename; }
// get the original file name $original_filename = $_FILES[‘form_fields’][$FORM_FIELD_FILE_ID][$file_count][‘name’];
// Bump counter for next file $file_count++; // Return your desired file name (original_filename) return $original_filename; }, 10, 4);
NOTE: You MUST Replace : $FORM_FIELD_FILE_ID = ‘image_upload‘;
with the name of YOUR Form.
If you don’t the Form will result in an Error like: x There was an error while trying to upload your file.