1
votes

I have a form field as below through which I can add multiple images at once. I am uploading image in admin panel which uses active-admin gem.

form(html: { multipart: true }) do |f|
f.inputs do
  f.input :title
  f.file_field :photos, multiple: true
end
f.actions
end

I want to be able to add multiple images so that I could create a folder for each upload in cloudinary and also view those images on my frontend (like photo album). So far, I could upload multiple images on cloudinary looking at the carrierwave+cloudinary documentation but I could not create a folder for each upload and show each images on the site. This is my code on photo_uploader.rb

class PhotosUploader < CarrierWave::Uploader::Base
 include Cloudinary::CarrierWave
 include CarrierWave::MiniMagick
 #storage :file
end
1

1 Answers

0
votes

You can include folder parameter on your upload like this(Ruby)-Cloudinary::Uploader.upload("sample_image.jpg", :public_id => "multiple/folders/sample")

or add it to your public id separated by '/'.

Example:http://res.cloudinary.com/demo/image/upload/v1364158979/multiple/folders/sample.jpg Here 'multiple' and 'folders' are folder name and 'sample' is the image name.

For more information: https://support.cloudinary.com/hc/en-us/articles/202520902-Can-I-create-folders-in-my-Cloudinary-account-