it works , to a point,
When an item is selected which isnt an image, e.g text.doc, it automatically brings up the error message, but if the file IS an image, it waits until you click Submit, before bringing up the same error message (but when it is an image, it actually uploads it fine),
so what i'm trying to say is, can anyone spot a problem with my code, so that it will stop showing this error message even though it is uploading ok.
Thanks
Expand|Select|Wrap|Line Numbers
- <asp:RegularExpressionValidator
- id="FileUpLoadValidator" runat="server"
- ErrorMessage="Upload Jpegs and Gifs only."
- ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.JPG|.gif|.GIF)$"
- ControlToValidate="FileUpload1">
- </asp:RegularExpressionValidator>
Expand|Select|Wrap|Line Numbers
- If FileUpload1.HasFile Then
- FileUpload1.SaveAs("C:\uploads\" & 1429 & ".jpg")
- End If