How to identify if the file is an Image (.jpg, .png ...) with Java/JavaFX? -
this question has answer here:
i searching how can identify or check if file selected user image (eg of extension: .jpg or .png or .bmp , more). note image not 1 file it's list of images.
i've tried code:
final file folder = new file( oo ); final file[] listoffiles = folder.listfiles(); imageview imageview = new imageview(); string mimetype = new mimetypesfiletypemap().getcontenttype( folder ); string type = mimetype.split( "/" )[0].tolowercase(); if ( !type.equals( "image" ) ) { //todo } else { //todo }
after trying code nothing changed still problem. how can , lot :-)
what expect getcontenttype if pass in folder instead of file listoffiles?
Comments
Post a Comment