[prev in list] [next in list] [prev in thread] [next in thread] 

List:       myfaces-user
Subject:    Antwort: [fileupload] need help dealing with large files!
From:       Andreas.Schmidt () hella ! com
Date:       2009-11-19 7:41:09
Message-ID: OF47728A85.2653BE0A-ONC1257673.0029AC7D-C1257673.002A3D98 () hella ! com
[Download RAW message or body]

--=_alternative 002A3D95C1257673_Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="ISO-8859-1"

Hello Khristian,

you have to get the error in the phase listener (Render Phase in before 
Phase).

public class myPhaseListener implements PhaseListener {

...

        public void beforePhase(PhaseEvent event) {

                // RENDER_RESPONSE Phase
                if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE)){

                        //error fileupload ?
                        Object req = 
context.getExternalContext().getRequest();
                        String message=null;
                        if (req instanceof MultipartRequestWrapper) {
                                MultipartRequestWrapper mpreq = 
(MultipartRequestWrapper) req;
                                Object m = 
mpreq.getAttribute("org.apache.myfaces.custom.fileupload.exception");
                                if(m!=null) 
message=m.toString().toLowerCase();
                                if (message!= null && 
message.indexOf("sizelimitexceeded")>-1) {
 
MessageUtils.addMessage(FacesMessage.SEVERITY_ERROR,"msg_FileSizeLimitExceeded",null);
                                }
                        }



                }

        }

}


best regards 
Andreas




Khristian <der.kosak@gmail.com>

18.11.2009 20:28
Bitte antworten an
"MyFaces Discussion" <users@myfaces.apache.org>


An
users@myfaces.apache.org
Kopie

Thema
[fileupload] need help dealing with large files!






Hello,
I'm trying to limit the size of files users can upload in my app, but
I can't figure out what to do when a user tries to upload some file
larger than the limit.
The limit is set in the web.xml file. Any file smaller than the limit
is handled without problem; when I try to upload a larger file, I
never get a response (not a exception, nor error, nor timeout).
How can I handle this situation correctly?
TIA,
--
Khristian Alexander Schönrock
http://derkosak.blogspot.com - Meu blógue!


--=_alternative 002A3D95C1257673_=--
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic