Archive for June, 2008
Protected: Creating and using Jasper Report in ASP.NET / How to create Jasper Report Web service and invoke it in ASP.NET? / How to create JRXML files using iReport 2.0.2?
Posted in ASP.NET, Java with tags create Jasper report using iReport, Invoke Jasper report webservice in ASP.NET, invoke Java webservice into ASP.NET on June 20, 2008 by hspinfoClient side validation of File type before you upload a file
Posted in ASP.NET with tags check extension before upload, check file extension, client side validation of file type, file type validation on June 18, 2008 by hspinfoTo validate a file type or say file extension on client side before you upload a file can be performed by just putting a Regular Expression Validator. Here, i have provided one example to allow uploading only .jpg or .gif files. All you need is a FileUpload control and a Regular Expression Validator to check file type.
<asp:FileUpload ID=”FileUpload1″ runat=”server” />
<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ControlToValidate=”FileUpload1″ Display=”Dynamic” ErrorMessage=”Upload a valid file” ValidationExpression=”^.+(.jpg|.JPG|.gif|.GIF)$”></asp:RegularExpressionValidator>
If you want to put your own file type validation then just replace “.jpg,.JPG,.gif,.GIF” text, and you can add more file types by adding “|” (pipe) sign and your own file type to validate.
Happy Coding!!