Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 5d4d239

Browse files
A sender of AjaxFileUpload events is fixed (Resolve #327) (#328)
1 parent 26874e4 commit 5d4d239

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

AjaxControlToolkit/AjaxFileUpload/AjaxFileUpload.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected override void OnInit(EventArgs e) {
253253
return;
254254

255255
var processor = new UploadRequestProcessor {
256-
Context = Context,
256+
Control = this,
257257
UploadStart = UploadStart,
258258
UploadComplete = UploadComplete,
259259
UploadCompleteAll = UploadCompleteAll,
@@ -522,19 +522,19 @@ static string GetGrandParentDirectoryName(string tmpFilePath) {
522522
}
523523

524524
class UploadRequestProcessor {
525-
public HttpContext Context;
525+
public AjaxFileUpload Control;
526526

527527
public EventHandler<AjaxFileUploadStartEventArgs> UploadStart;
528528
public EventHandler<AjaxFileUploadEventArgs> UploadComplete;
529529
public EventHandler<AjaxFileUploadCompleteAllEventArgs> UploadCompleteAll;
530530
public Action<string> SetUploadedFilePath;
531531

532532
HttpRequest Request {
533-
get { return Context.Request; }
533+
get { return Control.Context.Request; }
534534
}
535535

536536
HttpResponse Response {
537-
get { return Context.Response; }
537+
get { return Control.Context.Response; }
538538
}
539539

540540
public void ProcessRequest() {
@@ -603,7 +603,7 @@ void XhrStart() {
603603
var filesInQueue = int.Parse(Request.QueryString["queue"] ?? "0");
604604
var args = new AjaxFileUploadStartEventArgs(filesInQueue);
605605
if(UploadStart != null)
606-
UploadStart(this, args);
606+
UploadStart(Control, args);
607607
Response.Write(new JavaScriptSerializer().Serialize(args));
608608
}
609609

@@ -629,7 +629,7 @@ void XhrComplete() {
629629

630630
var args = new AjaxFileUploadCompleteAllEventArgs(filesInQueue, filesUploaded, completeReason);
631631
if(UploadCompleteAll != null)
632-
UploadCompleteAll(this, args);
632+
UploadCompleteAll(Control, args);
633633
Response.Write(new JavaScriptSerializer().Serialize(args));
634634
}
635635

@@ -654,7 +654,7 @@ void XhrDone(string fileId) {
654654
Path.GetExtension(originalFilename));
655655

656656
if(UploadComplete != null)
657-
UploadComplete(this, args);
657+
UploadComplete(Control, args);
658658

659659
Response.Write(new JavaScriptSerializer().Serialize(args));
660660
}
@@ -664,11 +664,11 @@ static string StripTempFileExtension(string fileName) {
664664
}
665665

666666
void XhrCancel(string fileId) {
667-
AjaxFileUploadHelper.Abort(Context, fileId);
667+
AjaxFileUploadHelper.Abort(Control.Context, fileId);
668668
}
669669

670670
void XhrPoll(string fileId) {
671-
Response.Write((new AjaxFileUploadStates(Context, fileId)).Percent.ToString());
671+
Response.Write((new AjaxFileUploadStates(Control.Context, fileId)).Percent.ToString());
672672
}
673673

674674
}

0 commit comments

Comments
 (0)