protected void UploadButton_Click(object sender, EventArgs e) { if (FileUploadControl.HasFile) { try { FUNC tbl = new FUNC(); string filename = Path.GetFileName(FileUploadControl.FileName); string fullpath = Config.GetTempPath + filename; FileUploadControl.SaveAs(fullpath); //StatusLabel.Text = "Upload status: File uploaded!"; tbl.update_func_mappings(Master.CurrentUserName, fullpath); } catch (Exception ex) { //StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message; throw ex; } } }
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { bool ret = false; string filePath = Config.GetTempPath + e.FileName; try { FUNC tbl = new FUNC(); // AjaxFileUpload1.SaveAs(filePath); ret = tbl.update_func_mappings(Master.CurrentUserName, filePath); } catch (Exception ex) { using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine("Message :" + ex.Message + Environment.NewLine + "StackTrace :" + ex.StackTrace + "" + Environment.NewLine + "Date :" + DateTime.Now.ToString()); writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine); } } }