2014-07-23 259 views
0

我想上傳多個file.as這個鏈接。 http://blueimp.github.io/jQuery-File-Upload/index.html多個文件上傳使用mvc使用jquery文件上傳插件

但是,當我點擊我的.cshtml中的添加文件沒有上傳預覽顯示在我的網頁。

請幫忙。

<!-- The template to display files available for upload --> 
     <script id="template-upload" type="text/x-tmpl"> 
    {% for (var i=0, file; file=o.files[i]; i++) { %} 
<tr class="template-upload fade"> 
    <td class="preview"><span class="fade"></span></td> 
    <td class="name"><span>{%=file.name%}</span></td> 
    <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
    {% if (file.error) { %} 
     <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> 
    {% } else if (o.files.valid && !i) { %} 
     <td> 
      <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div> 
     </td> 
     <td class="start">{% if (!o.options.autoUpload) { %} 
      <button class="btn btn-primary"> 
       <i class="icon-upload icon-white"></i> 
       <span>{%=locale.fileupload.start%}</span> 
      </button> 
     {% } %}</td> 
    {% } else { %} 
     <td colspan="2"></td> 
    {% } %} 
    <td class="cancel">{% if (!i) { %} 
     <button class="btn btn-warning"> 
      <i class="icon-ban-circle icon-white"></i> 
      <span>{%=locale.fileupload.cancel%}</span> 
     </button> 
    {% } %}</td> 
</tr> 

{%}%} 我在cshtmlpage的頭部中添加該代碼。 如何檢查此代碼是否有效?

回答

0

您一定錯過了cshtml文件中BeginForm()的ID屬性。

嘗試使用

@using(Html.BeginForm( 「YYYY」, 「XXXX」,FormMethod.Post,新的{ENCTYPE = 「多部分/格式數據」,ID = 「文件上傳」}))

Regards, Malay Kothari

相關問題