commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Kessler" <djkr...@gmail.com>
Subject Help: IE Request is empty, but Firefox is not???
Date Mon, 11 Feb 2008 17:13:04 GMT
Hello,

I have a JSF application running on JBoss and I am trying to upload a file
using the commons file upload api. I have tried with a filter and a phase
listener. I am able to upload a file via Firefox, but when I try with IE the
parseRequest results are empty. Could someone help me out? Here is some
code:

    public void afterPhase(PhaseEvent event) {

        FacesContext context = event.getFacesContext();

        HttpServletRequest httpRequest = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();

        boolean isMultipart = (httpRequest.getHeader("content-type") != null
&&

httpRequest.getHeader("content-type").indexOf("multipart/form-data")
!= -1);

        boolean onFaxAttachPage = (-1 != context.getViewRoot().getViewId().
                lastIndexOf("faxattach")) ? true : false;

        if (onFaxAttachPage && isMultipart) {

            DiskFileItemFactory factory = new DiskFileItemFactory();

            factory.setSizeThreshold(-1);

            ServletFileUpload fileUpload = new ServletFileUpload(factory);

            List fileList = null;

            try {
                fileList = fileUpload.parseRequest(httpRequest);
                System.out.println(fileList); //this returns [] in IE
            } ...

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message