• Resolved tgilber007

    (@tgilber007)


    
    add_action( 'forminator_post_data_field_post_saved', function($post_id, $field, $data){
    
       if($_POST['form_id'] == 87) {
         // example how to get the field
         $email = $_POST['email-1'];   //email retrieved
        $text = $_POST['text-1']; //text retrieved
         $imageurl = $_POST['upload-1']; // url not retrieved
    
         //code
    }
    }

    How to get the uploaded image file url

Viewing 1 replies (of 1 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @tgilber007

    I hope you’re well today!

    You are using hook that’s only valid for forms with “post data” field (so forms that create posts on site) and even then, the data passed to that hook would contain only fields directly related to post creation.

    If you want to catch just “any” data from the form, you’d need to use different hook, for example like this:

    add_action( 'forminator_form_after_save_entry', 'my_custom_function', 10, 2 );
    function my_custom_function( $form_id, $response ) {
    	
    	
    	error_log( print_r( $response, true ) );
        
    	if ( $form_id == 87 ) {
    	
    		$entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id );
    	
    		error_log( print_r( $entry, true ) );
    		
    	}
    }

    If you have WordPress debugging enabled (with DEBUG_LOG set to true) this code will print out entire entry content to /wp-content/debug.log file so you can see it’s structure and build your custom code based on it.

    The $entry in above example contains all the form data, including submssion ID, form ID and submission data and all the form fields and their submitted values.

    Best regards,
    Adam

Viewing 1 replies (of 1 total)
  • The topic ‘Get Uploaded File Url’ is closed to new replies.