View Single Post
  #1 (permalink)  
Old October 14th, 2006, 10:02 AM
rit01 rit01 is offline
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default FileUpload.Hasfile Question

Hi All

I am wanting to restrict my upload to only accepting JPG files. I have the following code to do so:

If FileUpload1.HasFile Then
            Dim objRegex As Regex = New Regex("(.*?)\.jpg")
            If Not objRegex.IsMatch(FileUpload1.PostedFile.FileName) Then
                lblstatus.Text = "Invalid Image format. Please make sure to use JPEG format (.jpg)."
         End If
End If

Using this code, would the file have been uploaded in ANY WAY before the check has been performed?.. there seems to be diferring opinion on the Net regarding the anwser.

Many thanks

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER