var xhr = this._xhrs[id] = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { self._onComplete(id, xhr); } }; xhr.open("POST", queryString, true); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.send(file);
Sub ProcessRequest(ByVal context As HttpContext) Implements HttpHandler.ProcessRequest Dim fileName As String = context.Request.QueryString("qqfile") if Not Database.IsValid(fileName) then begin context.Response.Write("{error:""Invalid file""}") Return end If Dim newFile As New FileStream(strPath + "\" + fileName, FileMode.Create) Dim body As Byte() = context.Request.BinaryRead(context.Request.TotalBytes) newFile.Write(body, 0, body.Length) newFile.Flush() newFile.Close() context.Response.Write("{success: true}") End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)