PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/BaliEnterpriseSystems/BaliEnterpriseSystems/BestUploader.aspx.cs

https://github.com/sirivedula/BEST
C# | 30 lines | 29 code | 1 blank | 0 comment | 3 complexity | 168b028e17561a5e104cd72d59bd393f MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace BaliEnterpriseSystems
  8. {
  9. public partial class BestUploader : System.Web.UI.Page
  10. {
  11. protected void Page_LoadComplete(object sender, EventArgs e)
  12. {
  13. if ((imgfile.PostedFile != null) && (imgfile.PostedFile.ContentLength > 0))
  14. {
  15. string fn = System.IO.Path.GetFileName(imgfile.PostedFile.FileName);
  16. string SaveLocation = Server.MapPath("Data") + "\\" + fn;
  17. try
  18. {
  19. imgfile.PostedFile.SaveAs(SaveLocation);
  20. Response.Write("The file has been uploaded.");
  21. }
  22. catch (Exception ex)
  23. {
  24. Response.Write("Error: " + ex.Message);
  25. }
  26. }
  27. }
  28. }
  29. }