ruby on rails - How to show image file when i select it in file browser , Carrierwave gem -


i using carrierwave gem image uploading. want achieve image upload , show after uploading completed.

i read wiki of gem , used same code not working.

= form_for @user, html: { :multipart => true, class: 'battle_form' } |f|   = image_tag(@user.file_attachment1_url) if @user.file_attachment1?   = f.file_field :file_attachment1, class:'fileinput', name:'image1'  = f.hidden_field :file_attachment1_cache 

carrierwave gem github

if want show image after upload, use img tag , upload file url like:

= image_tag(@image_url) 

this work after upload completed , refresh current page.

if want preview image before form submit, may find way javascript solve it, dropzonejs may you


Comments

Popular posts from this blog

Unable to open serial port using Putty to bluetooth device on windows 7 64 bit -

bash - How do you programmatically add a bats test? -

java - Getting exception in JDBC thin driver -