[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - upload file portlet on jboss...help

raffaele.letizia do-not-reply at jboss.com
Fri Jan 30 05:57:24 EST 2009


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 :
    
    
      
        
        
    
    
      
		
        
        
        
    
  
  
  
  
    
      
        
          
            &nbsp;
              HTML tags used in this form : 
          
          
            &nbsp;&lt;form
              method=&quot;post&quot;
              action=&quot;add.jsp&quot;
              name=&quot;upload&quot; enctype=&quot;multipart/form-data&quot;&gt;
          
          
            &nbsp;&lt;input
              type=&quot;file&quot;
              name=&quot;uploadfile&quot;
              size=&quot;50&quot;&gt;
          
        
      
    
  
  &nbsp;
  &nbsp;
  &nbsp;
  &nbsp;
  Copyright
    &copy; JavaZOOM 1999-2006




Where is the problem? Can we help me?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205823#4205823

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205823



More information about the jboss-user mailing list