I am using uploadify plugin to upload a file in asp.net. I used session to store file name in Handler.ashx page. I am unable to get session value i.e, file name at code behind this issue exists only in firefox.
public void ProcessRequest(HttpContext context)
{
try
{
context.Response.ContentType = "text/plain";
HttpPostedFile uploadFiles = context.Request.Files["Filedata"];
string DocPhysicalPath = System.Configuration.ConfigurationManager.AppSettings["DocPhysicalPath"].ToString();
// To get Filename with out extension
string strFileNameWithoutExt = System.IO.Path.GetFileNameWithoutExtension(uploadFiles.FileName);
// To get Filename extension
string strExtension = System.IO.Path.GetExtension(uploadFiles.FileName);
// Concat Filename with current date
string fileName = strFileNameWithoutExt + DateTime.Now.ToString("_yyyy_MM_dd_HH-mm-ss-fff") + strExtension;
HttpContext.Current.Session["uploadFileName"] = fileName;
string pathToSave = DocPhysicalPath + "Documents\\SecureDocExchange\\TempFiles\\" + fileName;
uploadFiles.SaveAs(pathToSave);
}
catch (Exception ex)
{
objCommon.SendMailException(ex.Message, this.GetType().Name, "ProcessRequest Exception");
}
}
protected void imgbtnUpLoad_Click(object sender, EventArgs e)
{
hdnClientId.Value = ddlCompany.SelectedValue;
int clientId = Convert.ToInt32(hdnClientId.Value);
string year = hdnYear.Value;
int folderId = 0;
if (hdnFolderId.Value != "")
folderId = Convert.ToInt32(hdnFolderId.Value);
string fileName = HttpContext.Current.Session["uploadFileName"].ToString();
}