please let me know that how can i upload an image using primeface fileUpload.i want to store the uploaded image into a folder and also want to resize the image using thumbnailator .i have already tried the primeface fileupload but not getting.
<p:fileUpload allowTypes="/(\.|\/)(gif|jpe?g|png)$/" auto="true" dragDropSupport="true" fileUploadListener="#{loginController.fileUploadHandler}" />
public void fileUploadHandler(FileUploadEvent event) throws IOException {
UploadedFile file = event.getFile();
InputStream inStream = file.getInputstream();
Os.write("C:\\Users\\think again\\Desktop\\uploaded\\pic.jpg", inStream);
Thumbnails.of(new File("C:\\Users\\think again\\Desktop\\uploaded").getAbsoluteFile()).size(100, 100).outputFormat("jpg").toFile("C:\\Users\\think again\\Desktop\\thumb");
}
but the file object contain a part item dont know what it is. will get the fileItem object inside the part.please help me to upload the image into the correspondding location