@Override
  public void decode(FacesContext context, UIComponent component) {
    FileUpload fileUpload = (FileUpload) component;
    String clientId = fileUpload.getClientId(context);
    MultipartRequest multipartRequest = getMultiPartRequestInChain(context);

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

      if (fileUpload.getMode().equals("simple")) {
        decodeSimple(context, fileUpload, file);
      }
    }
  }
  protected void encodeMarkup(FacesContext context, FileUpload fileUpload) throws IOException {
    if (fileUpload.getMode().equals("simple")) {
      ResponseWriter writer = context.getResponseWriter();
      String clientId = fileUpload.getClientId(context);

      writer.startElement("input", null);
      writer.writeAttribute("type", "file", null);
      writer.writeAttribute("id", clientId, null);
      writer.writeAttribute("name", clientId, null);

      if (fileUpload.getStyle() != null) {
        writer.writeAttribute("style", fileUpload.getStyle(), "style");
      }
      if (fileUpload.getStyleClass() != null) {
        writer.writeAttribute("class", fileUpload.getStyleClass(), "styleClass");
      }
      if (fileUpload.isDisabled()) {
        writer.writeAttribute("disabled", "disabled", "disabled");
      }

      writer.endElement("input");
    }
  }