ruby - Get full path of file_field image in rails -
i trying full path image uploading rails file_field helper.
%h4 upload image .col-sm-8 =label_tag "upload image" .col-sm-4 =form_tag(controller:"images", :html => {:multipart => true}) =select("app", "app", ["#{rails.env}_thing", "#{rails.env}_otherthing"], {include_blank: true}) =file_field :post, :image %button.btn.btn-primary.btn-block{:type => "submit"} ="upload image"
when hits controller action params are:
{"utf8"=>"✓", "authenticity_token"=>"kvf52okmdkqpte/ja99r33213123210wrklc2umhgdm=", "app"=>{"app"=>"development_thing"}, "post"=>{"image"=>"picture.png"}, "html"=>{"multipart"=>"true"}, "action"=>"create", "controller"=>"images"}
what want though full path of image file. how that? if uploaded desktop "/users/bob/desktop/picture.png"
thanks!
you can't fullpath of file via input type 'file'. browser not allow it. security feature in modern browsers.
in chrome u get
c:\fakepath\filename.ext
while in mozilla u filename
filename.ext
you can find lots of other question related this. see
Comments
Post a Comment