PageRenderTime 62ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/Demo/SelectedItems.aspx.cs

http://izwebfilemanager.googlecode.com/
C# | 44 lines | 35 code | 9 blank | 0 comment | 3 complexity | 37ac766248dad290ed55b961e9329e2e MD5 | raw file
 1using System;
 2using System.IO;
 3using IZ.WebFileManager;
 4
 5public partial class SelectedItems : System.Web.UI.Page
 6{
 7	protected void Page_Load (object sender, EventArgs e) {
 8
 9	}
10
11	protected void LogSelected (object sender, EventArgs e) {
12		SelectedItemsLog.Text = "";
13
14		if (FileManager1.SelectedItems.Length == 0)
15			SelectedItemsLog.Text = "Please, select any item first.<br />";
16		else
17			foreach (FileManagerItemInfo item in FileManager1.SelectedItems) {
18				SelectedItemsLog.Text += item.VirtualPath + "<br />";
19
20			}
21	}
22
23	protected void LogCurrentDirectory (object sender, EventArgs e) {
24		SelectedItemsLog.Text = "";
25		SelectedItemsLog.Text = FileManager1.CurrentDirectory.VirtualPath + "<br />";
26	}
27
28	protected void Upload(object sender, EventArgs e)
29	{
30		SelectedItemsLog.Text = "";
31		if(FileUpload1.HasFile)
32		{
33			string name = Path.GetFileName(FileUpload1.FileName);
34			string vdir = FileManager1.CurrentDirectory.VirtualPath;
35			string dir = FileManager1.CurrentDirectory.PhysicalPath;
36
37			FileUpload1.SaveAs(Path.Combine(dir, name));
38
39			SelectedItemsLog.Text = String.Format("File '{0}' was uploaded to '{1}' successfuly.<br />", name, vdir);
40		}
41		else
42			SelectedItemsLog.Text = "Please, select file to upload.<br />";
43	}
44}