2

I am using Jasny Bootstrap file upload control in my asp.net project.

It looks really good, but im unable to send the attached file to the server (a .ASHX webservice)

My layout code look like this

<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
shameer v m
  • 310
  • 2
  • 11
  • You need to look at how to use C# to handle file uploads, there are plenty of resources out there. – patricksweeney Nov 06 '12 at 03:31
  • @patricksweeney, thank you, but im trying to make the file upload more dependent on jquery & the C# ashx service rather than the c# back end code. – shameer v m Nov 06 '12 at 03:37
  • Then you need to research that, and THEN come back with a specific problem. Just saying your unable to do it doesn't give us anything to work with. What have you tried so far? What were you expecting? What happened? You'll get much better help that way. – patricksweeney Nov 06 '12 at 03:43

1 Answers1

5

The HTML contains an <input type="file" />. You need to set the name attribute of the input element. Also make sure that you're using enctype="multipart/form-data" in the form.

<form action="myscript.ashx" method="post" enctype="multipart/form-data">
  <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" name="myupload"/></span>
      <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
    </div>
  </div>
</form>
Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82