1

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>
Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82

2 Answers2

3

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.

fflyer05
  • 873
  • 11
  • 18
  • Hello Thanks for answering unfortunately we dont use forms as we use ajax calls to pass params to controller- so simply put that code was all it was. – Adrian Sibbaluca Oct 31 '12 at 07:51
0

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

The post by @Adeel solved my needs.

Community
  • 1
  • 1