Hi @Donald Symmons,
Is this how to limit file size for two FileUpload controls?
Yes.
PostedFile.ContentLength
is in bytes.
600kb=600000 Bytes
300kb=300000 Bytes
if (FileUpload1.PostedFile.ContentLength < 600000 && Filedoc.PostedFile.ContentLength < 300000)
{
string filePath = Path.GetFileName(FileUpload1.PostedFile.FileName);
string File = Path.GetFileName(Filedoc.PostedFile.FileName);
Label1.Text = "Image Uploaded Successfully!!";
}
else if(FileUpload1.PostedFile.ContentLength >= 600000)
{
Label1.Text = "Image1 must be less than 600kb";
}
else if (Filedoc.PostedFile.ContentLength >= 300000)
{
Label2.Text = "Image2 must be less than 300kb";
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.