I have to upload images into DB using file up-loader. I have used the given below code, but it is not working. If I upload any pdf or doc file that also inserting into DB and the error message also displaying. I want to stop insertion if the file is not an image format. Help me to find a proper solution. Thank you.
ASPX :
<asp:FileUpload ID="PhotoUpload1" runat="server" ForeColor="#999999" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ErrorMessage="*jpeg,gif,png" ControlToValidate="PhotoUpload1" ForeColor="Red"
ValidationExpression=".*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[bB][mM][pP])$">
</asp:RegularExpressionValidator>
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="Submit" />