2

我在我的 asp.net 项目中使用Jasny Bootstrap文件上传控件。

它看起来非常好,但我无法将附件发送到服务器(一个 .ASHX 网络服务)

我的布局代码如下所示

<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>
4

1 回答 1

5

HTML 包含一个<input type="file" />. 您需要设置输入元素的名称属性。还要确保您enctype="multipart/form-data"在表单中使用。

<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>
于 2012-12-30T20:27:07.123 回答