James
James

Reputation: 739

POST file upload Connection Reset

I'm working on a file upload script and I'm completely failing to get anything to upload.

When trying to upload a file I receive the following error code:

Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.

I've tried with multiple browsers and I've even grabbed a couple of super basic upload scripts from the web and tested to see if they will work and I'm still receiving the same error.

I've checked php.ini and the post size, memory limit, input time limit and execution time limit are all set to the defaults.

I've tried uploading muliple different files, from a couple of hundred bytes to a couple of MB and I still receive the same message.

I'm wondering if maybe it could be some kind of permissions issue with the temporary upload directory?

My php.ini file uploads section is as follows:

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

I've uploaded files to this server previously, about 2 weeks ago with no problems and as far as I know there have been no configuration changes since then.

I've also tried turning on error reporting, adding ini settings directly into the upload script and just echoing anything at the top of the upload script. I've run out of ideas for how to troubleshoot this now.

Upvotes: 1

Views: 6367

Answers (2)

Daniel
Daniel

Reputation: 41

I have sweated quite a bit on this problem, too. The answer was right there in the Apache log:

[Sun May 08 09:31:02 2016] [warn] [client 127.0.0.1] mod_fcgid: HTTP request length 137056 (so far) exceeds MaxRequestLen (131072), referer: http://mysamplesite.com

because I have configured PHP as a Fast Cgid module. The solution was to fix the value of the request length in httpd.conf:

<IfModule mod_fcgid.c>
    MaxRequestLen         10000000
</IfModule>

et voilà...

Note: according to your version of Apache, you may need the syntax

<IfModule mod_fcgid.c>
    FcgidMaxRequestLen         10000000
</IfModule>

Upvotes: 1

James
James

Reputation: 739

Problem was resolved by restarting Apache on our webserver.

sudo service apache2 restart

Apache version 2.2.22 (Ubuntu)

Ubuntu version 13.04

Upvotes: 1

Related Questions