Tuesday 10 April 2012

To Upload PDF Files Only Using Asp.net File Upload Control


File Upload Only PDF Files:
----------------------------
Using RegularExpressionValidator
================================
<asp:FileUpload ID="FileUpload1" runat="server" class="textb" Width="220px" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"  Text="Only PfFiles are allowed." ErrorMessage="Only PDF Files are allowed."
ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf)$" ControlToValidate="FileUpload1"></asp:RegularExpressionValidator>

1 comment:

  1. If you want to create an open pdf file from a blank document, you need to open it as an ODF file using a compatible reader. Open PDF readers are available both online and offline.

    ReplyDelete