Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

Checking valid Image File.

Hi,

I need to check a valid image file like jpg, png, bmp and etc.

Please help how to do it.

Thank you.
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Hi emi_sastra,

You can do something like:

Dim fi As New FileInfo(MyFileFullPath)
If fi.Extension = ".bmp" Or fi.Extension = ".jpg" Or fi.Extension = ".png" Then
  ' valid file
End If

Of couse someone could rename to that but if thats the case you can try to load it (in a different function using a error handling tho catch error) and check if it's valid. But this is heavy for the your application/system.
Avatar of emi_sastra
emi_sastra

ASKER

Hi,

I don't care its extension and I've already check its existing.
Could you please provide code how to check it as you mentioned?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Thank you very much for your help.