Exemple #1
0
        public void ProcessRequest(HttpContext context)
        {
            var request = context.Request;

            if (request.QueryString["contextKey"] != AjaxFileUpload.ContextKey)
            {
                throw new Exception("Invalid context key");
            }

            if (request.Headers["Content-Type"] != null &&
                request.Headers["Content-Type"].StartsWith("multipart/form-data;") &&
                request.Headers["Content-Length"] != null)
            {
                AjaxFileUploadHelper.Process(context);
            }
            else
            {
                throw new Exception("Invalid upload request.");
            }

            context.Response.ContentEncoding = Encoding.UTF8;
            context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            context.Response.ContentType = "text/plain";
            context.Response.End();
        }
 void XhrCancel(string fileId)
 {
     AjaxFileUploadHelper.Abort(Control.Context, fileId);
 }