We're using plupload for users to upload files to our VPS.
Here is the plupload code:
var uploader = new plupload.Uploader({
browse_button: 'fileSelectorLink',
container: 'uploadContainer',
drop_element: 'uploadbox',
url: '/UploadHandler.ashx',
unique_names: true,
multi_selection: false,
flash_swf_url: '/scripts/plupload/js/Moxie.swf',
silverlight_xap_url: '/scripts/plupload/js/Moxie.xap'
});
He is the code for processing the request:
Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim runtime As String = If(context.Request("runtime") IsNot Nothing, context.Request("runtime"), "Unknown")
If context.Request IsNot Nothing Then
If context.Request.Files.Count > 0 Then
Dim fileUpload As HttpPostedFile = context.Request.Files(0)
...
Else
' Throw an exception
End If
End Sub
Occasionally (about 2% of the time) the exception will get thrown. Here is an example of request that threw an error:
Runtime: html5
Request.ContentType: multipart/form-data; boundary=----WebKitFormBoundaryo7JAtlhKsg8xDcQT
Request.ContentLength: 3758089
Request.ContentEncoding: System.Text.SBCSCodePageEncoding
Request.TotalBytes: 3179067
The errors seem to happen across different browsers and OSs (even modern browsers), so that doesn't seem to be the issue. Plupload should fall back to other versions if browser doesn't handle async file uploads. I thought the ContentEncoding seemed odd, but it seems to always say that (maybe plupload works like that?). The only thing that jumped out at me is that the ContentLength and TotalBytes were different, but in my local testing they were the same. Could that be a problem?
Been stuck on this issue for a few days and haven't had any good leads.