Possible Duplicate:
Uploaded image only available after refreshing the page
I'm using primefaces to upload files to my application and it's working but I have a path problem .
I'm using netbeans IDE.
I'm storing the uploaded file under : (Project\web\WEB-INF\photo) as the following code shows :
public void FileUpload(FileUploadEvent event) throws IOException {
UploadedFile upfile = event.getFile();
InputStream in = new BufferedInputStream(upfile.getInputstream());
ExternalContext extContext =
FacesContext.getCurrentInstance().getExternalContext();
File file = new File(extContext.getRealPath
("//WEB-INF//photo//" + event.getFile().getFileName()));
FileOutputStream fout = new FileOutputStream(file);
byte[] bytes = new byte[1024];
while (in.available() != 0) {
fout.write(in.read());
}
fout.write(bytes);
fout.close(); .......
}
and this method works correctly but the uploaded file does'nt exist in the wanted directory (Project\web\WEB-INF\photo) but it's found under the build folder (Project\build\web\WEB-INF\photo) so then when i want to display the photo an error says that the photo does not exist in the directory ,
so any idea ? and why the file is stored under the build not in the wanted directory ??