简体   繁体   中英

how to add an upload button to active admin

I am trying to add a button which will call a popup windows to upload a file on a server. I am looking for paperclip alternative without need to use image preprocessor.

User flow is going to be next: - Log in into active admin - Click create new photo - Pick photo using file picker (a place where I am stuck) - Upload selected picture onto cloudinary or something similar to it.

I really could use paperclip but I am afraid it will require to many other dependencies on production server. What would you advice, my friend?

The simplest solution I can think of looks something like this:

ActiveAdmin.register User do
  form :html => { :multipart => true } do |f|
    f.inputs "Upload" do
      f.input :image, :type => :file
    end
    f.actions
  end
end

Maybe you missed the multipart attribute? Nevertheless, I'd suggest you to take a look at carriverwave ( https://github.com/carrierwaveuploader/carrierwave ).

If this is not helping you at all, please post some code examples. That will make it much easier for others to provide you some useful feedback.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM