Uploading a file in Rails

Update 2018 While everything written below still holds true, Rails 5.2 now includes active_storage, which allows stuff like uploading directly to S3 (or other cloud storage services), image transformations, etc. You should check out the rails guide and decide for yourself what fits your needs. While there are plenty of gems that solve file uploading pretty nicely (see https://www.ruby-toolbox.com/categories/rails_file_uploads for … Read more

Maximum request length exceeded.

If you are using IIS for hosting your application, then the default upload file size is 4MB. To increase it, please use this below section in your web.config – For IIS7 and above, you also need to add the lines below: Note: maxRequestLength is measured in kilobytes maxAllowedContentLength is measured in bytes which is why the values differ in this config … Read more

changing the owner of folder in linux

Use chown to change ownership and chmod to change rights. use the -R option to apply the rights for all files inside of a directory too. Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory. For example will change ownership (both user and group) … Read more

Multiple file upload in php

I know this is an old post but some further explanation might be useful for someone trying to upload multiple files… Here is what you need to do: Input name must be be defined as an array i.e. name=”inputName[]” Input element must have multiple=”multiple” or just multiple In your PHP file use the syntax “$_FILES[‘inputName’][‘param’][index]” Make sure to look for empty … Read more

jQuery Ajax File Upload

File upload is not possible through AJAX.You can upload file, without refreshing page by using IFrame.You can check further details here. UPDATE With XHR2, File upload through AJAX is supported. E.g. through FormData object, but unfortunately it is not supported by all/old browsers. FormData support starts from following desktop browsers versions. IE 10+ Firefox 4.0+ Chrome 7+ Safari 5+ Opera 12+ For … Read more