AnsweredAssumed Answered

Unexpected behaviour of my JAVA CLASS for upload

Question asked by oluwasegzy on Jul 18, 2011
I am trying to upload file into the alfresco repository using JAVA Backed webscript but i found out that my HTTPRequestServlet did not get hold of the content in my request.

I am using a multipart form and i expect to get hold of my request object is the server-side

I discovered this when i printed out the size of the items, i get zero(0) as the size.

Am i right by getting an HttpServletRequest object like this HttpServletRequest


Here is my Sample code

      HttpServletRequest httpReq=((WebScriptServletRequest)req).getHttpServletRequest();
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);
      FileItem fileItem=null;
      List items=upload.parseRequest(httpReq);
      System.out.println("number of file items " + items.size());
      Iterator It = items.iterator();
         FileItem  item= (FileItem);

and my form

<form action="${url.service}" method="post" enctype="multipart/form-data" accept-charset="utf-8">
       <tr><td>File:</td><td><input type="file" name="file"></td></tr>
       <tr><td>Title:</td><td><input name="title"></td></tr>
       <tr><td>Description:</td><td><input name="desc"></td></tr>
       <tr><td><input type="submit" name="submit" value="Upload"></td></tr>

Please i need help to resolve this issue