Upload Primefaces Directory

Asked

Viewed 313 times

2

I am uploading with Primefaces where the upload is in the Project Resources folder, but I want to use another directory for file storage, preferably in the root directory where Tomcat is.

Any suggestions on how to get this path?

Currently I am using so: FacesContext.getCurrentInstance().getExternalContext().getRealPath("/") + "resources/files/";

  • And where’s Tomcat? What’s his address..

2 answers

1

  • I reported a path type /User/Meuuser/Images but when returning to the view it concatenates localhost:8080/Project/User/Meuuser/Images/minhaimg.jpg.

0

I’m using it this way: XHTML: <p:graphicImage value="#{emitenteBean.myImage}"

BEAN:

private StreamedContent myImage;

try {
FileInputStream fileInputStream = new FileInputStream("/Users/user/files/minhaImg.jpg");
myImage = new DefaultStreamedContent(fileInputStream, "image/jpeg");

    } catch (FileNotFoundException e) {
        System.out.println("ERRO AO CONVERTER IMG.");
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.