I am uploading a file from file upload control in asp.net. On that page there is a checkbox. User have to accept condition before he can upload the file. I am checking on code behind file that if the checkbox is not checked that show an alert message but the problem is that before calling that function the file is going to buffer whole on server and then the function is going called. But i want to to check that condition before temporary uploading of that file.
Below is my code that I am working with-
protected void btn_Upload_Click1(object sender, EventArgs e)
{
if (!chkBx_1.Checked )
{
dataclass.Message("Please accept all terms before uploading", this);
return;
}
else
{
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs("path");
}
}
}