Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Uncaught TypeError: Cannot read property 'getAttribute' of undefined
- at Object.response (jsf.js.xhtml?ln=javax.faces&stage=Development:2814)
- at Object.onComplete (jsf.js.xhtml?ln=javax.faces&stage=Development:1779)
- at FrameTransport.AjaxEngine.req.xmlReq.onreadystatechange (jsf.js.xhtml?ln=javax.faces&stage=Development:1760)
- at FrameTransport.callback (jsf.js.xhtml?ln=javax.faces&stage=Development:367)
- at HTMLIFrameElement.<anonymous> (jsf.js.xhtml?ln=javax.faces&stage=Development:400)
- <h:inputFile value="#{imagemPerfil.arquivo}" required="true" >
- </h:inputFile>
- <h:commandButton
- class="btn btn-primary" value="Salvar" action="#{imagemPerfil.handleFileUpload()}">
- <f:ajax execute="@form" render="@form" />
- </h:commandButton>
- </h:form>
- /**
- *
- */
- private static final long serialVersionUID = 3131478679593318664L;
- private Part arquivo;
- private UploadedFile uploadFile;
- public Part getArquivo() {
- return arquivo;
- }
- public void setArquivo(Part arquivo) {
- this.arquivo = arquivo;
- }
- public UploadedFile getUploadFile() {
- return uploadFile;
- }
- public void setUploadFile(UploadedFile uploadFile) {
- this.uploadFile = uploadFile;
- }
- public MudarImagemPerfil() {
- }
- public void handleFileUpload() {
- if(arquivo != null) {
- System.out.println("file size: " + arquivo.getSize());
- System.out.println("file type: " + arquivo.getContentType());
- }else {
- System.out.println("Arquivo está nulo");
- }
- }
Add Comment
Please, Sign In to add comment