elenapeskova
/
how-to-save-uploaded-files-by-handling-the-filesuploadcomplete-server-event-e3067
Public
forked from DevExpress-Examples/asp-net-web-forms-upload-control-save-files-on-the-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.aspx.cs
34 lines (29 loc) · 1.21 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DevExpress.Web;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e){
}
protected void ASPxUploadControl1_FilesUploadComplete(object sender, DevExpress.Web.FilesUploadCompleteEventArgs e){
// Intentionally pauses server-side processing to demonstrate the Loading Panel or Progress Panel functionality
System.Threading.Thread.Sleep(2000);
ASPxUploadControl uploadControl = sender as ASPxUploadControl;
if (uploadControl.UploadedFiles != null && uploadControl.UploadedFiles.Length > 0){
for (int i = 0; i < uploadControl.UploadedFiles.Length; i++){
UploadedFile file = uploadControl.UploadedFiles[i];
if (file.FileName != ""){
string fileName = string.Format("{0}{1}", MapPath("~/Images/"), file.FileName);
//file.SaveAs(fileName, true);//OnLine Demo Restriction
}
}
}
}
}