Hi,
file_in$ = requestfile$( "Load File", "jpg,bmp,png" )
loadimage file_in$
Because the above also includes 'All Files' I'd only like to load if jpg,bmp,png files.
i.e. is there a way to check the type of a file?
Thanks
Jim
You could check the extention ?
file_in$ = Trim$(Lower$(file_in$))
if right$(file_in$, 4) = ".jpg" then print "This is a .jpg"
Else, you could read the file itself and look for the header: BMP starts with BM something, JPG starts with 2 bytes, then JFIF.
ff = ReadFile("c:\_xfiles\grass.bmp")
For i = 0 To 10
c = ReadByte(ff)
Print Chr$(c)
Next
CloseFile ff
WaitKey()
End
As far as I know this
FileName$=RequestFile("Image File","jpg;*.png;*.bmp")
will only let you search for files with extensions jpg,bmp or png - I don't get an option for 'all files'.
Thanks guys,
I used both methods as 'RequestFile' still allows the user to select file type as All Files from the lower menu.
Thanks
Jim