Monday, August 8, 2016

Asynchronous Multiple File Upload with Rails and Dropzone.js

The Application

Our application is a module of an e-commerce shop to create products and attach pictures to them. It uploads the pictures on the server, returns the list of uploaded files, and then submits the form to create the product record. There is a one-to-many association between pictures and product, meaning that a product may have many images.

Here is the database schema:

38329356-1acc-11e6-85ef-39a73b823cb7

Let's jump to our code. First, make a new Rails application by opening your terminal and typing:

rails new myapp

We need to add the Javascript and CSS files for Dropzone and Bootstrap, so please go to the dist folder from the Dropzone and Bootstrap downloads and find the following files:

bootstrap.css
dropzone.css
basic.css
dropzone.js

Continue reading %Asynchronous Multiple File Upload with Rails and Dropzone.js%


by Vahob Rasti via SitePoint

No comments:

Post a Comment