hi, i have set a condition on the upload function

if (FileUploadControl1.PostedFile == null) {

lblResult.Text = "Please select a file first";

}

else

{
//upload a file
}

but if i press upload button when no file is selected it still uploads a blank file regardless of the "if' condition i set, does any1 know why this might be?

cheers

Try this:

if ([B]FileUploadControl1.HasFile[/B])
{
    //upload a file   
}
else
{
    lblResult.Text = "Please select a file first";   
}

thanks that worked!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.