0
votes

I'm using dropzone-rails to add dropzone to my Rails app. I'm using CarrierWave for image uploads which is working fine without Dropzone.

I'm creating my dropzone programatically. The Dropzone seems to be working to some extent as the image gets added to the drop zone but it outputs tons of random HTML. The image doesn't get uploaded either.

Here's what it looks like:

enter image description here

My Canvas model has an :image attribute for the uploaded images. I don't know what the URL for the dropzone form should be, so I just went with /canvases/21, because the page I'm currently trying it on is /canvases/21. I'm guessing the URL is causing the problem.

var canvasDropzone = new Dropzone("#canvas", {
  paramName: "canvas[image]",
  url: "/canvases/21"
})

<div id="canvas"></div>

My canvas.rb:

mount_uploader :image, ImageUploader
2

2 Answers

0
votes

url should be a link to your controller create action

url: "/canvases"

and then in your routes

ressources canvases, only: [:create] 
0
votes

I noticed that #canvas is the id of a div. it should be the id of the form itself not the div. thats why you are not getting the dropzone styling you want.

once you do that, then no need to use url as it will be defined in the form tag also. perhaps show us a snippet of your form and controller to be of better help.