Hi everyone,
I've managed to get the struts file upload working successfully,
using the struts FormFile class and the upload example.
Cool :-)
However, in my app, I only want images to be uploaded.
I'm going to store the images on disk and put the path of the
image file into the database. So I need to validate that only images
are getting uploaded, not other file-types.
I know nothing really about how to do this. I could just check that
string returned by:
FormFile.getContentType( )
is equal to image-gif, image-bnp, or image-jpeg. But is this enough?
Also, I have noticed that when I upload an image file and the little
Browser window pops up, if I select a gif image, but the file type
bar says "All files" then the file isn't recognized as an image.
It's recognized as an octet-stream. So does the browser window
specify the file type to the browser?
Anyway,
Hope someone can give me some advice,
As always,
Thanks very much,
Brian