/BaliEnterpriseSystems/BaliEnterpriseSystems/BestUploader.aspx.cs
C# | 30 lines | 29 code | 1 blank | 0 comment | 3 complexity | 168b028e17561a5e104cd72d59bd393f MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace BaliEnterpriseSystems
- {
- public partial class BestUploader : System.Web.UI.Page
- {
- protected void Page_LoadComplete(object sender, EventArgs e)
- {
- if ((imgfile.PostedFile != null) && (imgfile.PostedFile.ContentLength > 0))
- {
- string fn = System.IO.Path.GetFileName(imgfile.PostedFile.FileName);
- string SaveLocation = Server.MapPath("Data") + "\\" + fn;
- try
- {
- imgfile.PostedFile.SaveAs(SaveLocation);
- Response.Write("The file has been uploaded.");
- }
- catch (Exception ex)
- {
- Response.Write("Error: " + ex.Message);
- }
- }
- }
- }
- }