plupload asp.net handler incomplete files

qsharp

New Member
When i set runtimes to "html4" everything works perfectly. All the other runtimes (which are better because you can select multiple files at one time) seem to work fine to, except that the files are not completely uploaded. After a few kb (42 / 28 / 50) it says '100% completed'. The files are stored and are incomplete. Any ideas?\[code\]$("#uploader").plupload({// General settingsruntimes : 'gears,flash,silverlight,browserplus,html5',url : 'upload.ashx',max_file_size : '10mb',chunk_size : '1mb',unique_names : true,// Resize images on clientside if we canresize : {width : 320, height : 240, quality : 90},// Specify what files to browse forfilters : [ {title : "Image files", extensions : "jpg,gif,png"},{title : "Zip files", extensions : "zip"} ], // Flash settings flash_swf_url : 'js/plupload.flash.swf', // Silverlight settings silverlight_xap_url : 'js/plupload.silverlight.xap'});// Client side form validation$('form').submit(function(e) { var uploader = $('#uploader').plupload('getUploader'); // Files in queue upload them first if (uploader.files.length > 0) { // When all files are uploaded submit form uploader.bind('StateChanged', function() { if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) { $('form')[0].submit(); } }); uploader.start(); } else alert('You must at least upload one file.'); return false;});\[/code\]upload.ashx:public Class upload : Implements IHttpHandler\[code\]Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim chunk As Integer = If(context.Request("chunk") IsNot Nothing, Integer.Parse(context.Request("chunk")), 0) Dim fileName As String = If(context.Request("name") IsNot Nothing, context.Request("name"), String.Empty) Dim fileUpload As HttpPostedFile = context.Request.Files(0) Dim uploadPath = context.Server.MapPath("uploads") Using fs = New FileStream(Path.Combine(uploadPath, fileName), If(chunk = 0, FileMode.Create, FileMode.Append)) Dim buffer = New Byte(fileUpload.InputStream.Length - 1) {} fileUpload.InputStream.Read(buffer, 0, buffer.Length) fs.Write(buffer, 0, buffer.Length) End Using context.Response.ContentType = "text/plain" context.Response.Write("Success")End SubPublic ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End GetEnd Property\[/code\]
 
Top