public void user(object sender, ServerValidateEventArgs args)
{
if (Path.GetExtension(pp.PostedFile.FileName) == ".png" || Path.GetExtension(pp.PostedFile.FileName).ToUpper() == ".gif".ToUpper() || Path.GetExtension(pp.PostedFile.FileName).ToUpper() == ".jpg".ToUpper())
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
<input type=file id="pp" runat="server" />
<asp:CustomValidator ID="CustomValidator1"
ControlToValidate="pp"
OnServerValidate="user" ValidationGroup="l"
Text="only Images Format!"
runat="server"/>
<asp:Button ID="btm" runat="server" ValidationGroup="l" Text="submit"
onclick="btm_Click" />
{
if (Path.GetExtension(pp.PostedFile.FileName) == ".png" || Path.GetExtension(pp.PostedFile.FileName).ToUpper() == ".gif".ToUpper() || Path.GetExtension(pp.PostedFile.FileName).ToUpper() == ".jpg".ToUpper())
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
<input type=file id="pp" runat="server" />
<asp:CustomValidator ID="CustomValidator1"
ControlToValidate="pp"
OnServerValidate="user" ValidationGroup="l"
Text="only Images Format!"
runat="server"/>
<asp:Button ID="btm" runat="server" ValidationGroup="l" Text="submit"
onclick="btm_Click" />
No comments:
Post a Comment