How to upload multiple file inputs in rails production?
I'm trying to upload multiple file inputs from single form. The form is working fine in development, but in production the form showing that redirecting for long time and returns nothing. Can some one help me to resolve this issue.
Thanks in advance.
What size of file are you working with? Your production server probably has file size restrictions in nginx/apache that you may need to tweak.
The files aren't large in size. I'm trying to upload two image files from a single form. So, i think size does not matter then.
Ok, but did you still verify your upload limit wasn't set too low? Two images can easily be over the 1mb default setting for nginx, for instance, 1 picture from my phone is around 5mb in size... http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
If file size limits are good to go, then next step would be to figure out what you're using to manage your uploads... Refile / Paperclip / Carrierwave / etc...?
Are you using a 3rd party for file storage, such as Amazon S3?
Have you monitored your error logs to see what the error actually is? You can set your production logs temprarily to debug, then ssh into your production server and
tail -f production.log in your console - then try uploading your files. I bet you'll see some sort of error that will help you track your issue down.
I've already checked in nginx conf and it has client_max_body_size 50M; For uploading images i'm using paperclip for one image upload and manually moving another image. Both are different kinds of upload.
What do you see when running
tail -f your_app_folder/shared/log/production.log on the server before trying to updload as Jacob sugguested?
Couple of more things come to mind to check... make sure all the proper directories exist and that they all have the proper permissions for your server. Since you're manually moving one of the files, you could be running into an issue there. I've forgotten to create remote directories countless times...!
I've checked all the required folders for file storage and all are there. The form submitting smoothly when i added single file, but when i add multiple file it showing only redirection and nothing happening after that.
Good, that's a few more things we can check off the troubleshooting list!
Have you watched your logs when you upload? I'm almost positive you'll see some sort of error in there that will help you narrow down the cause. There's not a whole lot more we can help with if you can't show the logs or at least report back with what errors are being thrown in the logs. Ultimately, if you can, create a git repo that reproduces the problem so we can clone and look into it.