public void uploadFile(FileUploadEvent event) {
        try {        
            String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/resources/images/tmp"); 
            String archivo = path + File.separator + event.getFile().getFileName();
            FileOutputStream fileOutputStream = new FileOutputStream(archivo);   
            byte[] buffer = new byte[6124];      
            int bulk;       
            InputStream inputStream = event.getFile().getInputstream();
            while (true) {        
                bulk = inputStream.read(buffer);
                if (bulk < 0) {     
                    break;       
                }         
                fileOutputStream.write(buffer, 0, bulk); 
                fileOutputStream.flush();    
            }     
            fileOutputStream.close();
            inputStream.close();
            this.setImageTemp(event.getFile().getFileName()); 
        } catch (IOException e) { 
            e.printStackTrace();  
            FacesContext.getCurrentInstance().addMessage("", new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "Error al subir el archivo"));  
        } 
    }