Package org.primefaces.model

Examples of org.primefaces.model.UploadedFile


    }
       
   
    public void handleFileUpload(FileUploadEvent event) {
       
        UploadedFile file = event.getFile();

        FileHD fileHD = new FileHD();
       
        fileHD.setName(file.getFileName());
        fileHD.setContent(file.getContents());
        fileHD.setUploadedDate(new Date());
        fileHD.setRequest(current);
        fileHD.setUploadedBy(curUser);
        listFiles.add(fileHD);
       
        JsfUtil.addSuccessMessage(ResourceBundle.getBundle("property",
                FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                getString("fileUploaded") + " " + file.getFileName());
    }     
View Full Code Here


        this.fileContent = fileContent;
    }

    public void upload(FileUploadEvent event) throws IOException {

        UploadedFile uploadedFile = event.getFile();

        if (uploadedFile.getFileName().contains(".jpg")
                || uploadedFile.getFileName().contains(".doc")
                || uploadedFile.getFileName().contains(".DOC")
                || uploadedFile.getFileName().contains(".docx")
                || uploadedFile.getFileName().contains(".DOCX")
                || uploadedFile.getFileName().contains(".PDF")
                || uploadedFile.getFileName().contains(".pdf")
                || uploadedFile.getFileName().contains(".XLS")
                || uploadedFile.getFileName().contains(".xls")
                || uploadedFile.getFileName().contains(".xlsx")
                || uploadedFile.getFileName().contains(".XLSX")
                || uploadedFile.getFileName().contains(".JPG")
                || uploadedFile.getFileName().contains(".png")
                || uploadedFile.getFileName().contains(".PNG")) {

            setFileContent(uploadedFile.getContents());
            setUploadedFileName(uploadedFile.getFileName());
        }
    }
View Full Code Here

  public void handleFileUpload(FileUploadEvent event) {
    System.out.println("chechUpload");
    System.out.println("Uploaded: {}" + event.getFile().getFileName());

    try {
      UploadedFile file = event.getFile();
      System.out.println(file.getContents().toString());
      byte[] source = file.getContents();
      for (int i = 0; i < source.length; i++)
        System.out.print((char) i);

      FacesMessage msg = new FacesMessage("Succesful", event.getFile()
          .getFileName() + " is uploaded.");
View Full Code Here

   
    if(multipartRequest != null) {
      FileItem file = multipartRequest.getFileItem(clientId);

      if(file != null) {
        UploadedFile uploadedFile = new DefaultUploadedFile(file);

                if(fileUpload.getMode().equals("simple"))
                    fileUpload.setSubmittedValue(uploadedFile);
                else
                    fileUpload.queueEvent(new FileUploadEvent(fileUpload, uploadedFile));
View Full Code Here

    public void setFile(UploadedFile file) {
        this.file = file;
    }

    public void handleFileUpload(FileUploadEvent event) {
        UploadedFile file = event.getFile();
        MessageUtil.addInfoMessage("upload.successful", file.getFileName() + " is uploaded.");
    }
View Full Code Here

   
    if(multipartRequest != null) {
      FileItem file = multipartRequest.getFileItem(clientId);
     
      if(file != null) {
        UploadedFile uploadedFile = new DefaultUploadedFile(file);
        fileUpload.queueEvent(new FileUploadEvent(fileUpload, uploadedFile));
      }
    }
  }
View Full Code Here

   
    if(multipartRequest != null) {
      FileItem file = multipartRequest.getFileItem(fileUpload.getInputFileId(facesContext));
     
      if(file != null) {
        UploadedFile uploadedFile = new DefaultUploadedFile(file);
        fileUpload.queueEvent(new FileUploadEvent(fileUpload, uploadedFile));
      }
    }
  }
View Full Code Here

        HttpSession session = FacesUtils.getSession();
        Employee employee = (Employee) session.getAttribute(DataKeeperConstants.EMPLOYEE);

        DataKeeperService service = DataKeeperUtils.getService();

        UploadedFile file = event.getFile();

        if (file != null)
        {
            DocumentInfo dataInfo = new DocumentInfo();
            dataInfo.setData(file.getContents());
            dataInfo.setDocumentName(file.getFileName());
            dataInfo.setSize(file.getSize());
            dataInfo.setOwnerName(employee.getEmployeeName());
            dataInfo.setOwnerId(employee.getEmployeeId());
            dataInfo.setUplodedDate(new Date());

            service.insertData(dataInfo);

            FacesMessage msg = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
            FacesContext.getCurrentInstance().addMessage(null, msg);

            return "successfully uploaded";
        }
        return "uploading fail";
View Full Code Here

        }
      }

      if (selectedAlbum != null)
      {
        UploadedFile file = uploadRequest.getFile();
        String fileName = file.getFileName();
        byte[] fileBytes = file.getContents();
        String photoTitle = uploadRequest.getTitle();
        String photoDescription = uploadRequest.getDescription();

        logger.info("Processed uploaded file {} of size {} for album {}", new Object[] { fileName,
            fileBytes.length, selectedAlbum });
View Full Code Here

     * @param event Ermöglicht den Zugriff auf die geladene Datei.
     */
    public void handleFileUpload(FileUploadEvent event) { 
        FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, msg);
        UploadedFile file = event.getFile();
        try {
        AltdatenKonverter me = new AltdatenKonverter(file.getInputstream());

        me.extractArchivale();

        CompassConfiguration conf = new CompassConfiguration().configure();
        conf.addClass(Archivale.class);
View Full Code Here

TOP

Related Classes of org.primefaces.model.UploadedFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.