2016-04-29 5 views
0

Ich habe ein Problem mit dem jquery.filedrop.js Plugin.jquery Fileupload Plugin Probleme in Chrome

Es funktioniert in der VS2012-Version dieses Projekts, deshalb bin ich mir nicht sicher, warum genau in meiner neuen VS2015-Version dieses Projekts kaputt ist.

Die Anwendung wurde ursprünglich in Asp.Net MVC 5 in VS2012 entwickelt. Ich portierte es dann ohne Probleme auf VS2015 und fuhr mit der weiteren Entwicklung fort.

Die Ausnahme tritt in jquery.filedrop.js-Plugin, wenn ich ziehen/die cvs-Datei auf dem Ablegebereich fallen (auch Screenshot unten):

xhr.sendAsBinary() exception

xhr.sendAsBinary() exception

In Upload.cshtml, ich habe diese js und hTML-Code:

$(".dropzone").filedrop({ 
 
\t url: "@Url.Action("_UploadMultiple", "Portfolio")", 
 
\t paramname: "files", 
 
\t maxFiles: 10, 
 
\t maxfilesize: 10, // max file size in MB 
 
\t allowedfiletypes: [], // ["text/plain", "text/csv", "application/csv", "text/xml", "application/xml"] // Filetypes allowed by Content-Type, empty array means no restrictions 
 
\t allowedfileextensions: [".csv", ".xml"], 
 
\t dragOver: function() { 
 
\t \t $(".dropzone").css("background", "#eee"); 
 
\t }, 
 
\t dragLeave: function() { 
 
\t \t $(".dropzone").css("background", "#fff"); 
 
\t }, 
 
\t drop: function() { 
 
\t \t $(".dropzone").css("background", "#eee"); 
 
\t \t // Add spinner 
 
\t \t $(".dropzone > p").html("<i class='fa fa-2x fa-refresh fa-spin'></i><br /><strong>Processing</strong>"); 
 
\t \t 
 
\t }, 
 
\t afterAll: function() { 
 
\t \t Alert.windowOk("Completed", "All files were processed. Please check the output for details.", "success", 
 
\t \t \t function() { 
 
\t \t \t \t $(".dropzone").css("background", "#fff"); 
 
\t \t \t \t // Remove spinner 
 
\t \t \t \t $(".dropzone > p").html("<i class='fa fa-2x fa-arrow-up'></i><br /><strong>Drop CSV or XML files here to upload</strong>"); 
 
\t \t \t } 
 
\t \t); 
 
\t }, 
 
\t uploadFinished: function (i, file, response, time) { 
 
\t \t UP.updateResults(response); 
 
\t }, 
 
\t error: function (err, file) { 
 
\t \t switch (err) { 
 
\t \t \t default: 
 
\t \t \t \t break; 
 
\t \t } 
 
\t \t $(".dropzone").css("background", "#fff"); 
 
\t \t // Remove spinner 
 
\t \t $(".dropzone > p").html("<i class='fa fa-2x fa-arrow-up'></i><br /><strong>Drop CSV or XML files here to upload</strong>"); 
 
\t } 
 
});
@{ 
 
    ViewBag.Title = "Upload"; 
 
    ViewBag.Breadcrumb = "Upload"; 
 
} 
 

 
@section styles { 
 
    /* styles are here...*/ 
 
} 
 

 
<form id="upload-form" action="@Url.Action("_Upload", "Portfolio")" method="POST" enctype="multipart/form-data"> 
 
@Html.AntiForgeryToken() 
 
<div class="row"> \t 
 
\t <div class="col-md-2 dropzone" style="margin-top:10px;"> 
 
\t \t <p class="text-center" style="margin-top:10px;"> 
 
\t \t \t <i class="fa fa-2x fa-arrow-up"></i> 
 
\t \t \t <br /> 
 
\t \t \t <strong>Drop CSV or XML files here to upload</strong> 
 
\t \t </p> 
 
\t </div> 
 
</div> 
 
</form> 
 

 
@section scripts { 
 
    <script src="@Url.Content("~/Scripts/jquery.filedrop.js")" type="text/javascript"></script>

Meine jquery-Version ist: jQuery JavaScript Library v1.10.2, das ist das gleiche wie das ursprüngliche Projekt mit funktionierender Filedrop-Version.

jquery.filedrop.js Version: 0.1.0 von https://github.com/weixiyen/jquery-filedrop

In diesem Screenshot heruntergeladen wird, zeige ich, wie es aussieht, wenn die Ausnahme auftritt und die Verarbeitung Spinner animiert bleibt.

enter image description here

Ich frage mich, wenn ich einen jquery Konflikt irgendwo habe, und wenn jemand eine Anleitung zur Verfügung stellen könnte, wie diese Ausnahme zu lösen.

danke, Bob

Antwort

0

ich den Konflikt zu pace.js verfolgt, durch die inspinia.js Design-Vorlage verwendet (ich die inspinia Vorlage von wrapbootstrap.com bekam).

Auskommentieren pace.min.js in BundleConfig.cs entfernt den Konflikt.

nun herausfinden, wie sie pace.js und Fileupload können Seite an Seite leben ...

bundles.Add(new ScriptBundle("~/bundles/plugins").Include(
 
         "~/Scripts/plugins/metisMenu/metisMenu.min.js", 
 
         //"~/Scripts/plugins/pace/pace.min.js", 
 
         "~/Scripts/plugins/inspinia/inspinia.js", 
 
         "~/Scripts/plugins/inspinia/skin.config.min.js"));

Werfen Sie einen Blick auf die jquery.filedrop.js in Chrome Debug-Fenster. Sie können die pace.min Referenz sehen, während ich den Mauszeiger über das XMLHttpRequest Objekt halte.

enter image description here