Please check http://jakarta.apache.org/commons/fileupload/dependencies.html

Regards,
____________________________________________
Alfredo Ledezma Melendez.
Costumer Record Management
Consultor Externo de Sistemas de Atencion a Clientes
RadioMovil DIPSA, S. A. de C. V.
Ejercito Nacional No. 488, Col. Anahuac, C.P. 11570
Mexico D.F. 

-----Original Message-----
From: Pete Raleigh [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 3:36 PM
To: commons-user@jakarta.apache.org
Subject: RE: [PortletFileUpload] class compiling error

That's because it isn't a "servlet" - it's a portlet. Are these files really
necessary? It uses the ActionRequest object, rather than an
HttpServletRequest object - which are very different in a Portal Server. I
have been struggling with this all day and have still not progressed very
far. Has anyone managed to upload a file through a Portlet (JSR 168) or is
this not possible?

Cheers, Pete.

-----Original Message-----
From: Alfredo Ledezma Melendez [mailto:[EMAIL PROTECTED]
Sent: 31 March 2005 22:29
To: [EMAIL PROTECTED]
Subject: RE: [PortletFileUpload] class compiling error

I think the problem is the classpath value. Check that you have tools.jar
and servlet.jar in it.

Regards,
____________________________________________
Alfredo Ledezma Melendez.
Costumer Record Management
Consultor Externo de Sistemas de Atencion a Clientes RadioMovil DIPSA, S. A.
de C. V.
Ejercito Nacional No. 488, Col. Anahuac, C.P. 11570 Mexico D.F.

-----Original Message-----
From: Pete Raleigh [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 2:09 PM
To: commons-user@jakarta.apache.org
Subject: [PortletFileUpload] class compiling error

I would appreciate some assistance in creating a JSR 168 compliant File
Upload Portlet. I have downloaded the 1.1-dev JAR from the commons website
(Nightly build) but seem to be having problems compiling.

My (trimmed) code is as follows:
...
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.portlet.PortletFileUpload;
...
private String processUpload(ActionRequest request, ActionResponse response)
{
        String txt = "";

        File tmpDir = new File("D:\\Temp\\Upload");
        DiskFileItemFactory dfif = new DiskFileItemFactory(10240, tmpDir);
        ...
        PortletFileUpload pfu = new PortletFileUpload(dfif);
        ...
        try
        {
                List fileItems = pfu.parseRequest(request);
                Iterator iter = fileItems.iterator();

                while (iter.hasNext())
                {
                        FileItem item = (FileItem)iter.next();
                        if (item.isFormField())
                        {
                                // Input text field
                                txt += "FIELD NAME: " + item.getFieldName +
"<br>";
                                txt += "VALUE: " + item.getString() +
"<br><br>";
                        } else {
                                // Uploaded file
                                txt += "FIELD NAME: " + item.getFieldName()
+ "<br>";
                                txt += "FILE SIZE: " + item.getSize() +
"<br><br>";
                        }
                }

        } catch (FileUploadException fue) {
                txt += "File Upload Exception: " + fue + "<br>";
        } catch (Exception e) {
                txt += "Exception: " + e + "<br>";
        }
        ...
}
...

The error message I receive is:
com\lcltd\raleigh\jsr168\WCMTools.java:139: cannot access
javax.servlet.http.HttpServletRequest
file javax\servlet\http\HttpServletRequest.class not found
                                List fileItems = pfu.parseRequest(request);
                                                    ^
1 error

I have struggled to find what I am doing wrong and have seen plenty of
references to the HttpServletRequest version (1.0) on Google, but nothing
for a Portlet code example version. What have I missed? :) Do I need to
write additional code for one of these classes - is this class and other
classes in the package unfinished? Does anyone have any example (working)
snippets?

Any help you could provide would be greatly appreciated.

Cheers, Pete.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to