Title: [Plugin: NextGEN Gallery] Invalid upload. Error Code : 3
Last modified: August 20, 2016

---

# [Plugin: NextGEN Gallery] Invalid upload. Error Code : 3

 *  Resolved [Jeffrey](https://wordpress.org/support/users/h0tw1r3/)
 * (@h0tw1r3)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-invalid-upload-error-code-3-4/)
 * 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() )
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [JustBlog](https://wordpress.org/support/users/justblog/)
 * (@justblog)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-invalid-upload-error-code-3-4/#post-2711139)
 * Thanks mate! Just got this solved! 😉
 *  [Natacha](https://wordpress.org/support/users/chickwithbob/)
 * (@chickwithbob)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-invalid-upload-error-code-3-4/#post-2711152)
 * 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.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: NextGEN Gallery] Invalid upload. Error Code : 3’ is closed to
new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Natacha](https://wordpress.org/support/users/chickwithbob/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-nextgen-gallery-invalid-upload-error-code-3-4/#post-2711152)
 * Status: resolved