WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Invalid upload. Error Code : 3 (3 posts)

  1. h0tw1r3
    Member
    Posted 2 years ago #

    Hopefully this helps others who may run into this problem. I see there was a post about this a year ago with no response.

    Problem
    When attempting to upload multiple files using the flash uploader (ie. plupload), after the first file every subsequent file would return the error and fail.

    "Invalid upload. Error Code : 3"

    Observation
    Without going into the nitty-gritty details, essentially the browser is using the same connection (keepalives) for subsequent uploads which causes the files to be rejected (UPLOAD_ERR_PARTIAL).

    Solution
    Implicitly send the 'Connection: close' header. Tells the browser not to reuse the connection for the next request (in this case, upload).

    patch
    Essentially, add header('Connection: close'); to nextgen-gallery/admin/upload.php.

    diff --git a/wp-content/plugins/nextgen-gallery/admin/upload.php b/wp-content/plugins/nextgen-gallery/admin/upload.php
    index c8ba083..88edd05 100644
    --- a/wp-content/plugins/nextgen-gallery/admin/upload.php
    +++ b/wp-content/plugins/nextgen-gallery/admin/upload.php
    @@ -23,6 +23,7 @@ unset($current_user);
     require_once(ABSPATH . '/wp-admin/admin.php');
    
     header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
    +header('Connection: close');
    
     //check for correct capability
     if ( !is_user_logged_in() )
  2. JustBlog
    Member
    Posted 2 years ago #

    Thanks mate! Just got this solved! ;)

  3. chickwithbob
    Member
    Posted 2 years ago #

    YESSSSSS - thx so much for this fix!

    No idea why this started occurring for us in the first place but adding the line

    header('Connection: close');

    fixed it for us also.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic