Click here to Skip to main content
16,010,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here Error is like that File Upload show null value on Button Save Click.Tell Me what I have to do to fix this.
C#
if (fluplogo.HasFile)//Here  Value of File upload  Is Null
        {
            string FilePath = "";
            string[] a = new string[1];
            string fileName = "";
            string FullName = "";
            try
            {
                if (fluplogo.FileName.Length > 0)
                {
                    a = fluplogo.FileName.Split('.');
                    fileName = Convert.ToString(System.DateTime.Now.Ticks) + "." + a.GetValue(1).ToString();
                    FilePath = Server.MapPath(@"~\InstituteLogo");
                    fluplogo.SaveAs(FilePath + @"\" + fileName);

                    FullName = FilePath + @"\" + fileName;
                    // Database Save Operation of filename.

                }
            }
            catch
            {
            }
        }
Posted
Updated 13-Jun-13 20:16pm
v2
Comments
Can you post the mark-up in aspx page?
RelicV 14-Jun-13 2:52am    
Do you have an Update Panel in your page..?

1 solution

Try to use the following line of code in place of your problematic line where you are getting null value.. hope your problem gona solve.


if (fluplogo.PostedFile != null && fluplogo.PostedFile.ContentLength > 0)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900