Support » Plugin: WP Multi File Uploader » Auto Refresh/Redirect after file upload success?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dholloran

    (@dholloran)

    Greetings,

    Honestly, it has been a really long time since I have done anything with this plugin so hopefully this helps. I believe it still uses either a file input or a hidden input behind the scenes so you could check for the change of those inputs. Another option may be to check for the click of the button that may be a little if something goes wrong. I personally would go with another option if I wanted the page to refresh like a traditional form. Feel free to let me know if you need any more help.

    Thanks,
    Dan

    Hey! Sorry I missed this! I actually have things set up to automatically create a post with each image that is uploaded via functions.php. So a submit button works to refresh the page, but the images that were loaded, already have created posts on initial upload.

    What would be even better is if this action only applied to images uploaded by your plugin and not anywhere else.

    Here is the code in my functions:

    add_action('add_attachment', 'create_post');
    function create_post( $attach_ID ) {
    
        $attachment = get_post( $attach_ID );
    
        $my_post_data = array(
                    'post_title' => $attachment->post_title,
                    'post_type' => 'product',
                    'post_category' => array('0'),
                    'post_status' => 'draft',
    
        );
    
        $post_id = wp_insert_post( $my_post_data );
    
        // attach media to post
        wp_update_post( array(
            'ID' => $attach_ID,
            'post_parent' => $post_id,
        ) );
    
        set_post_thumbnail( $post_id, $attach_ID );
    
        return $attach_ID;
    }

    1) Is it possible to have this action only occur with your plugin uploads
    2) Where would I adjust the hidden input that you referred to earlier?

    Thanks for any insight you have and sorry for the late reply!

    Kylie

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Auto Refresh/Redirect after file upload success?’ is closed to new replies.