Given code is inside a Upload button click.My code of upload file is:
if (this.fuImage.HasFile) //fuImage is id of FileUploader
{
string fileName=this.fuImage.FileName;
string strSaveLocation = Path.Combine(physicalpath, fileName);
this.fuImage.SaveAs(strSaveLocation);
}
Its work fine.If fuImage has file its save a file on desire location and page is refresh.But if there is not any file and I click a upload button nothing happen no error but page is refresh.I think it is postback issue.Is there any method to prevent to refresh a page if fuImage hasn’t any file.
Note:Uploader and button both are server side control.
Thanks.
You don’t use
RequiredFieldValidatorto check whether the file upload control has a file or not?