You're handling a 'post' submission in the doGet method? Is that what you want?
-- Martin Cooper On 7/4/07, Hoyer, Henning [ETHDE] <[EMAIL PROTECTED]> wrote:
Hi, this is a very interesting issue that has been bugging me for the past couple of days and I'm running out of ideas here. Hopefully one of you guys has had a similar issue before and can help. For starters, here is my form code: <form action="AttachDoc" method="post" enctype="multipart/form-data"> <input type="hidden" name="question" id="question" value="<%= question.getId() %>" /> <p class="right"> <input type="file" id="document" name="document" /> <input type="submit" value="Add Document" /> </p> </form> and here is the servlet that handles the upload: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int id = -1; int delete = -1; String fName = null; InputStream fInStream = null; String contentType = null; List items = null; Iterator iter; out = response.getWriter(); if( ServletFileUpload.isMultipartContent(request) ) { DiskFileItemFactory dfiFactory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload( dfiFactory ); try { items = upload.parseRequest( request ); iter = items.iterator(); while( iter.hasNext() ) { FileItem fItem = (FileItem)iter.next(); if( fItem.isFormField() ) { String name = fItem.getFieldName(); if( name.equals( "question" ) ) { id = Integer.parseInt( fItem.getString() ); } }//if( fItem.isFormField() ) else { fName = fItem.getName(); contentType = fItem.getContentType(); //boolean isInMemory = fItem.isInMemory(); //long sizeInBytes = fItem.getSize(); fInStream = fItem.getInputStream(); } }//while( iter.hasNext() ) } catch( FileUploadException fue ) { fue.printStackTrace( out ); } }//if else { logger.info( "Request is not Multipart" ); if( request.getParameter( "question" ) == null ) { out.print( "Error: getting question ID." ); return; } id = Integer.parseInt( request.getParameter( "question" ) ); delete = request.getParameter( "delete" ) == null ? -1 : Integer.parseInt( request.getParameter( "delete" ) ); } Question question = DfaqQuestions.getByID( id ); if( question == null ) { out.print( "Error: Can't get question." ); return; } ...Rest left out for brevity... As you can see, the Form calls the servlet directly, no framework whatsoever is involved, just a couple of jsps and servlets. When I use Firefox (2.0.0.4) everything works great. With IE however, (IE 6) the request is completely empty. I also tried to print out the request data to system.out and it is true: With FF there is data (whole pdf file, form field etc.) , with IE the request contains absolutely _nothing_! While I'm sure that this has nothing to do with the library itself, I'm just hoping that one of you has seen this before. thanks much in advance, henning --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]