Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir's,

I am using a file upload control to upload a file.
Whenever I execute the code, the compiler steps out from
if(FileUpload1.HasFile)


The compiler does not go to the inner part of the if block.

Can anybody please help me?
Posted
Updated 1-Nov-10 20:39pm
v2
Comments
NMehta83 2-Nov-10 2:52am    
If the browse control does not select any file and if its blank textbox then the compiler will not go to the inner part of the if block.

choose this code instead of your code
if (FileUpload1.PostedFile.ContentLength != 0)
{
}
 
Share this answer
 
you can also use

if(FileUpload1.FileName!="")<br />
{<br />
}
 
Share this answer
 

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



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