using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using NLog; using ETS_Data; namespace ETS_WS.WebUserControls { public partial class mod_fileUpload : System.Web.UI.UserControl { public event EventHandler eh_fileCaricato; protected Logger lg; protected void Page_Load(object sender, EventArgs e) { lg = LogManager.GetCurrentClassLogger(); } /// /// completato upload file /// /// /// protected void fileUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { string path = WebShipUtils.mng.UserTempPath; // ora il file... try { if (path != "") { // carico path e file path = string.Format("{0}/{1}", path, System.IO.Path.GetFileName(e.FileName)); fileUpload.SaveAs(MapPath(path)); lg.Info("salvato file: {0}, {1:#.0} Kb", path, (double)e.FileSize / 1024); if (eh_fileCaricato != null) { eh_fileCaricato(this, new EventArgs()); } } } catch (Exception exc) { lg.Info("errore salvataggio: {0}", exc); } } } }