0 Replies Latest reply on Jan 30, 2009 5:57 AM by raffaele letizia

    upload file portlet on jboss...help

    raffaele letizia Newbie

      HI,
      i'm a new. I want to create a portlet that upload file... i have found a simpleupload.jsp with usebeans but i have problme because i can search the file but don't upload.
      the text is:

      <%@ page language="java" import="javazoom.upload.*,java.util.*" %>
      <%@ page errorPage="ExceptionHandler.jsp" %>

      <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
      <jsp:setProperty name="upBean" property="folderstore" value="Users/raffaele/Uploads"/>
      </jsp:useBean>

      <%
      if (MultipartFormDataRequest.isMultipartFormData(request))
      {
      // Uses MultipartFormDataRequest to parse the HTTP request.
      MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
      String todo = null;
      if (mrequest != null) todo = mrequest.getParameter("todo");
      if ( (todo != null) && (todo.equalsIgnoreCase("upload")) )
      {
      Hashtable files = mrequest.getFiles();
      if ( (files != null) && (!files.isEmpty()) )
      {
      UploadFile file = (UploadFile) files.get("uploadfile");
      if (file != null) out.println("Form field : uploadfile"+" Uploaded file : "+file.getFileName()+" ("+file.getFileSize()+" bytes)"+" Content Type : "+file.getContentType());
      // Uses the bean now to store specified by jsp:setProperty at the top.
      upBean.store(mrequest, "uploadfile");
      }
      else
      {
      out.println("No uploaded files");
      }
      }
      else out.println(" todo="+todo);
      }
      %>



      Select a file to upload :





















       
      HTML tags used in this form :


       &lt;form
      method=&quot;post&quot;
      action=&quot;add.jsp&quot;
      name=&quot;upload&quot; enctype=&quot;multipart/form-data&quot;&gt;


       &lt;input
      type=&quot;file&quot;
      name=&quot;uploadfile&quot;
      size=&quot;50&quot;&gt;





       
       
       
       
      Copyright
      &copy; JavaZOOM 1999-2006




      Where is the problem? Can we help me?