Hi,

I tried your code an it gives me this errors when I click my upload
Button.


[INFO] <H1>HTTP Status 405 - HTTP method POST is not supported by this
URL</H1>
<HR noShade SIZE=1>

<P><B>type</B> Status report</P>
<P><B>message</B> <U>HTTP method POST is not supported by this URL</
U></P>
<P><B>description</B> <U>The specified HTTP method is not allowed for
the requested resource (HTTP method POST is not supported by this
URL).</U></P>
<HR noShade SIZE=1>

<H3>Apache Tomcat/5.0.28</H3>

On Aug 30, 3:29 am, Ron Lawrence <[EMAIL PROTECTED]> wrote:
> FYI all, you can use the same RPC servlet to handle thefileupload,
> simply override "service" in the RPC servlet, then handle thefileuploadas 
> shown in the examples above. In the case where it's not
> multipart, or there is no uploadedfile, just call super to keep the
> RPC framework happy.
>
> You will also need to set your form's action with
> formPanel.setAction( GWT.getModuleBaseURL() + "Servletname" ); use the
> same servlet name that's in your module's or web.xmlfile.
>
>   @Override
>   protected void service( HttpServletRequest request,
>     HttpServletResponse response ) throws ServletException,
> IOException
>   {
>     boolean isMultipart = ServletFileUpload.isMultipartContent( new
> ServletRequestContext(
>       request ) );
>     if ( isMultipart )
>     {
>       FileItem uploadItem = getFileItem( request );
>       if ( uploadItem == null )
>       {
>         super.service( request, response );
>         return;
>       }
>
>       response.setContentType( "text/plain" );
>       byte[] fileContents = uploadItem.get();
>       // verify thefilehere....
>       String myFile = new String(fileContents);
>       if (myFile.contains( "xxxx" ))
>       {
>         //do stuff with the data....
>         response.getWriter().write( "OK" );
>       }
>       else
>       {
>         response.getWriter().write( "Invalidfile");
>       }
>     }
>     else
>     {
>       super.service( request, response );
>     }
>   }
>
>   private FileItem getFileItem( HttpServletRequest request )
>   {
>     FileItemFactory factory = new DiskFileItemFactory();
>     ServletFileUploadupload= new ServletFileUpload( factory );
>    upload.setSizeMax( 10000000 );
>
>     try
>     {
>       List<FileItem> items =upload.parseRequest( request );
>       for ( FileItem item : items )
>       {
>         if ( !item.isFormField()
>           && "upload".equals( item.getFieldName() ) )
>         {
>           return item;
>         }
>       }
>     }
>     catch ( FileUploadException e )
>     {
>       return null;
>     }
>     return null;
>   }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to