{"action":"created","issue":{"url":"https://api.github.com/repos/primefaces/primefaces/issues/455","labels_url":"https://api.github.com/repos/primefaces/primefaces/issues/455/labels{/name}","comments_url":"https://api.github.com/repos/primefaces/primefaces/issues/455/comments","events_url":"https://api.github.com/repos/primefaces/primefaces/issues/455/events","html_url":"https://github.com/primefaces/primefaces/issues/455","id":89486863,"number":455,"title":"Text is being saved as images by Primefaces fileUpload","user":{"login":"evesmary","id":5446449,"avatar_url":"https://avatars.githubusercontent.com/u/5446449?v=3","gravatar_id":"","url":"https://api.github.com/users/evesmary","html_url":"https://github.com/evesmary","followers_url":"https://api.github.com/users/evesmary/followers","following_url":"https://api.github.com/users/evesmary/following{/other_user}","gists_url":"https://api.github.com/users/evesmary/gists{/gist_id}","starred_url":"https://api.github.com/users/evesmary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evesmary/subscriptions","organizations_url":"https://api.github.com/users/evesmary/orgs","repos_url":"https://api.github.com/users/evesmary/repos","events_url":"https://api.github.com/users/evesmary/events{/privacy}","received_events_url":"https://api.github.com/users/evesmary/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-19T07:03:06Z","updated_at":"2015-06-22T04:54:01Z","closed_at":null,"body":"I have a fileuploader and inputtext in a page. When I paste a text copied from a microsoft excel file to the inputtext component, the file uploader method is being invoked. As the result, the text is being saved as an image by primefaces fileUpload component.\r\n\r\nUsing PrimeFaces 5.1, JSF 2.1 Mojarra, Spring 3.2.13 and tomcat 7. Windows 7 professional, Microsoft Excel 2013 (xlsx).\r\ncommon-fileupload-1.2.2, commons-io-2.4.\r\n\r\nSteps : Copy the cell from the excel. Single click on the cell and ctrl+c and paste the same to inputtext component.\r\n\r\nThis issue doesnot occur if you double cllick the cell and copy its text contents only.\r\n\r\nFile upload component is used to upload an image there..it is not connected with the inputtext component.\r\nThis inputtext is input value to another variable for some other use.\r\n\r\nPlease note that this issue is not reproducible in linux machines.\r\n\r\nUpdate: \r\nI tested in Chrome41, firefox 38 and Safari. This issue occurs only in Chrome.\r\n\r\nTestBean\r\n\r\n    private String name; //include its getter and setter\r\n    public StreamedContent getImage() throws IOException {\r\n        FacesContext context = FacesContext.getCurrentInstance();\r\n        int petId=0;\r\n        String petSpecies = \"\";\r\n        if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {\r\n            return new DefaultStreamedContent();\r\n        }\r\n        else {\r\n            petSpecies = \"Dog\";\r\n            FilesModel petPic = null; /*new FilesModel()*/;\r\n            if(petPic == null){\r\n                ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();\r\n                InputStream input;\r\n                if(petSpecies.equalsIgnoreCase(\"Dog\")){\r\n                    input = externalContext.getResourceAsStream(\"/images/dog-no-image.jpg\");\r\n                }else{\r\n                    input = externalContext.getResourceAsStream(\"/images/cat-no-image.jpg\");\r\n                }\r\n                DefaultStreamedContent content = new DefaultStreamedContent(input);\r\n                content.setContentType(\"image/jpeg\");\r\n                return content;\r\n            }else{\r\n                return new DefaultStreamedContent(new ByteArrayInputStream(petPic.getFile()));\r\n            }\r\n        }\r\n    }\r\n\r\n    public void handleFileUpload(FileUploadEvent event) {\r\n        FacesContext context = FacesContext.getCurrentInstance();\r\n        int petId = Integer.parseInt((String) event.getComponent().getAttributes().get(\"petId\"));\r\n\r\n            //Code to save to database\r\n\r\n        FacesMessage message = new FacesMessage(\"Succesful\", event.getFile()\r\n                .getFileName() + \" is uploaded.\");\r\n        FacesContext.getCurrentInstance().addMessage(null, message);\r\n    }\r\n\r\ntest.xhtml\r\n\r\n\r\n    <h:form prependId=\"false\" id=\"asdf\">\r\n    <p:growl id=\"notifications\" showDetail=\"false\" autoUpdate=\"true\" globalOnly=\"true\" />\r\n    <p:inputText\r\n            value=\"#{testBean.name}\"\r\n            label=\"Spouse Name\" id=\"spousename\" >\r\n    </p:inputText>\r\n\r\n    <h:panelGrid columns=\"2\" >\r\n        <p:graphicImage alt=\"No Image\" styleClass=\"ui-button\"\r\n            value=\"#{testBean.image}\"\r\n            style=\"height:50px;width:55px;\" id=\"petPhotoId\"\r\n            onclick=\"uploadFn();\" cache=\"false\">\r\n            <f:param name=\"petId\" value=\"1\" />\r\n            <f:param name=\"species\" value=\"dog\" />\r\n        </p:graphicImage>\r\n        <p:fileUpload id=\"upl\"  style=\"display:none;\" \r\n            fileUploadListener=\"#{testBean.handleFileUpload}\"\r\n            mode=\"advanced\" dragDropSupport=\"false\" label=\"Change\"\r\n            auto=\"true\" sizeLimit=\"5000000\" fileLimit=\"3\"\r\n            allowTypes=\"/(\\.|\\/)(gif|jpe?g|png)$/\"\r\n            invalidFileMessage=\"Invalid File Type\"\r\n            invalidSizeMessage=\"Invalid File Size\">\r\n            <f:attribute name=\"petId\" value=\"1\" />\r\n        </p:fileUpload>\r\n    </h:panelGrid>\r\n    </h:form>\r\n<script>\r\n   function uploadFn(row){\r\n       $('#upl_input').click()\r\n    }\r\n</script>\r\n\r\nweb.xml\r\n\r\n     <filter>\r\n           <filter-name>PrimeFaces FileUpload Filter</filter-name>\r\n            <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>\r\n      </filter>\r\n       <filter-mapping>\r\n          <filter-name>PrimeFaces FileUpload Filter</filter-name>\r\n           <servlet-name>Faces Servlet</servlet-name>\r\n           <dispatcher>FORWARD</dispatcher>\r\n        </filter-mapping>\r\n\r\nSee http://forum.primefaces.org/viewtopic.php?f=3&t=42520"},"comment":{"url":"https://api.github.com/repos/primefaces/primefaces/issues/comments/114003078","html_url":"https://github.com/primefaces/primefaces/issues/455#issuecomment-114003078","issue_url":"https://api.github.com/repos/primefaces/primefaces/issues/455","id":114003078,"user":{"login":"evesmary","id":5446449,"avatar_url":"https://avatars.githubusercontent.com/u/5446449?v=3","gravatar_id":"","url":"https://api.github.com/users/evesmary","html_url":"https://github.com/evesmary","followers_url":"https://api.github.com/users/evesmary/followers","following_url":"https://api.github.com/users/evesmary/following{/other_user}","gists_url":"https://api.github.com/users/evesmary/gists{/gist_id}","starred_url":"https://api.github.com/users/evesmary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evesmary/subscriptions","organizations_url":"https://api.github.com/users/evesmary/orgs","repos_url":"https://api.github.com/users/evesmary/repos","events_url":"https://api.github.com/users/evesmary/events{/privacy}","received_events_url":"https://api.github.com/users/evesmary/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T04:54:00Z","updated_at":"2015-06-22T04:54:00Z","body":"I tested in Chrome41, firefox 38 and Safari. This issue occurs only in Chrome...inputtext means p:inputText..I have update the issue with the test code."}}