How to get File Location using Jasny File Upload

自闭症网瘾萝莉.ら 提交于 2020-01-03 03:39:06

问题


I wanted to pass the File Location to my Controller I have been using data-bind ="value: x" on each element here but to no available I can't catch the file location.

I'm using this script from Jasny Bootstrap FileUpload

<div class="fileupload fileupload-new" data-provides="fileupload">
  <div class="input-append">
    <div class="uneditable-input span3"><i class="icon-file fileupload-exists"></i> 
<span class="fileupload-preview"></span></div><span class="btn btn-file">
<span class="fileupload-new">Select file</span><span class="fileupload-exists">Change</span>
<input type="file" /></span><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
  </div>
</div>

回答1:


It would be helpful if you posted your entire form.
I have been struggling with the setup at first only to realize that all I had to do was set :multipart => true in the form.

<%= form_for @item, :html => {:multipart => true} do |f| %>

Once you do that, you should be able to get the file path in the controller. I am not sure if that is a solution to your problem though. Again, it would help if you showed more code and what you are currently getting in the params when you submit the form.




回答2:


Check out same question with some answers on a different post: jQuery Ajax File Upload

The post by @Adeel solved my needs.



来源:https://stackoverflow.com/questions/13118407/how-to-get-file-location-using-jasny-file-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!