简体   繁体   English

使用jvc文件上传插件使用mvc进行多个文件上传

[英]multiple file upload using mvc using jquery file upload plugin

i want to upload multiple file.as this link. 我想上传多个file.as这个链接。 http://blueimp.github.io/jQuery-File-Upload/index.html . http://blueimp.github.io/jQuery-File-Upload/index.html

But when i click the addfile in my .cshtml no uploaded preview display in my webpage. 但是,当我单击.cshtml中的添加文件时,网页上没有显示上传的预览。

Please Help. 请帮忙。

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

{% } %} i add this code in head section of my cshtmlpage . {%}%}我将此代码添加到cshtmlpage的头部。 how to check this code is work? 如何检查此代码是否正常工作?

you must have missed the ID attribute in BeginForm() in cshtml file. 您必须错过了cshtml文件中BeginForm()中的ID属性。

Try Using 尝试使用

@using (Html.BeginForm("YYYY", "XXXX", FormMethod.Post, new { enctype = "multipart/form-data", id = "fileupload" })) @using(Html.BeginForm(“ YYYY”,“ XXXX”,FormMethod.Post,新的{enctype =“ multipart / form-data”,id =“ fileupload”}))

Regards, Malay Kothari 问候,马来人Kothari

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM