Git Product home page Git Product logo

file_upload's Introduction

Sample App: CarrierWave Multiple File Upload

This app demonstrates an example of how to use the CarrierWave gem to facilitate multiple file uploads. This is a Rails 3.2.3 application that uses Ruby 1.9.3 and was developed on Mac Lion OS X.

CarrierWave is easy to set up and by default allows just one file to be uploaded at a time. To upload more than one file at a time, I’ve made use of the Jquery-File-Upload plugin. This plugin expects a json response and uses AJAX to update the page with the upload results. To facilitate the creation of a json response, I use the Jbuilder gem.

The example here has two models, Gallery and Photos. Gallery has many Photos. Photo belongs to Gallery. Since these two models are nested, I took the nested resources approach.

Since we’re uploading image files, we’ll want to use a gem called MiniMagick which is a Ruby wrapper for ImageMagick. Use HomeBrew to install ImageMagick: brew install imagemagick.

One side note regarding Carrierwave: when photos are deleted, the corresponding file folders become empty, but are not removed. This is a Carrierwave “feature”, and work-arounds can be found online. Paperclip, another popular upload gem cleans up its folders nicely and is easy to use as well.

file_upload's People

Contributors

csjaba avatar

Stargazers

 avatar  avatar

Watchers

 avatar

file_upload's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.