4

I am using rails 4.2 and nginx in my production. I have a form with multiple file fields. Till yesterday, this functionality has been working as expected. But a strange issue just arrived.

Issue is: while posting this form, it gets loading. I checked the error log of nginx, did not find anything. While checking the access log, I got the 400 status for that request after timed out.

I have inspected by disabling the file fields. If in that form, one file field is active, then it works. But activating more than one file field such error occurred.

000.11.221.162 - - [19/Aug/2016:11:41:16 +0000] "POST /categories HTTP/1.1" 400 0 "http://someapp.com/categories/new" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"

Has anyone faced such type of issue. Any suggestion will be helpful.

nginx configuration

http{
    passenger_root /usr/local/rvm/gems/ruby-2.1.0@global/gems/passenger-5.0.21;
    passenger_ruby /usr/local/rvm/gems/ruby-2.1.0/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
            listen                80;
            server_name           xxx.xxx.xxx.xx;
            passenger_enabled     on;
            root                  /path/to/rails/public;
            rails_env             production;
            client_max_body_size    0;
            client_body_timeout     600s;
            send_timeout            600s;
        }
}
rakeshpatra
  • 683
  • 8
  • 24

1 Answers1

0

It's actually pretty easy to upload multiple files using carrierwave.

https://github.com/carrierwaveuploader/carrierwave/blob/master/README.md#multiple-file-uploads

  • It's not about multi-file upload for a single field, it's for single file upload for multiple fields in a single forms. – rakeshpatra Aug 20 '16 at 15:58