dear fellas,
i want to check my fileuploas size
if bigger then 2mbm error message will popup,
this is my some of my code
If file_newimage.HasFile = True Then
Dim ext As String
ext = System.IO.Path.GetExtension(file_newimage.FileName).ToString
If ext <> ".jpg" And ext <> ".png" And ext <> ".bmp" And ext <> ".jpeg" Then
MessageUser("Photo uploaded must be in .jpg/.png/.bmp/.gif or .jpeg format")
Else
If file_newimage.PostedFile.ContentLength > 2097000.0 Then
MessageUser("File is too large.")
Else
'continue to save and upload image
Dim Path As String
Dim tmpfilename As String
Dim fileexist As Boolean
fileexist = True
Path = Server.MapPath("~/Vessel/VImage/")
While fileexist = True
tmpfilename = System.Guid.NewGuid().ToString()
ext = System.IO.Path.GetExtension(file_newimage.FileName).ToString
If File.Exists(Path & tmpfilename & ext) = True Then
fileexist = True
Else
fileexist = False
clsVE.ivesselimage = "../Vessel/VImage/" & tmpfilename & ext
Exit While
End If
End While
but when i input image 12MB, just to check my coding
my page went "Page cant be displayed"
can anyonw tell me why is this happening?
why is it my message didnt popup?