Christophe,

Here's my html:

<%@ page session="false" %>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri='/WEB-INF/tld/portlet.tld' prefix='portlet'%>
<portlet:defineObjects/>

<form action=<portlet:actionURL/> enctype="multipart/form-data"
method="post">
<input type="file" name="foo"/><br>
<input name="method" type="submit" value="Submit"/>
</form><br>

Thanks,
Nik

> -----Original Message-----
> From: Christophe Lombart
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 25, 2005 6:32 AM
> To: Jetspeed Users List
> Subject: Re: File upload using commons fileuploader not working
>
>
> I'm using the same component in Graffito and it works with Jetspeed 2.
> Your code seems correct. Maybe an issue in the html form.
>
> Christophe
>
> nik gonzalez wrote:
>
> >By the way, its a JSR 168 portlet that i deployed  in Fusion.
> >
> >Thanks,
> >Nik
> >
> >
> >
> >>-----Original Message-----
> >>From: nik gonzalez [mailto:[EMAIL PROTECTED]
> >>Sent: Wednesday, February 23, 2005 5:05 PM
> >>To: [email protected]
> >>Subject: File upload using commons fileuploader not working
> >>
> >>
> >>Hello,
> >>
> >>I ran the following code in my portlet.
> >>
> >>            PortletFileUpload dfu = new PortletFileUpload();
> >>            //get the FileItems
> >>            List fileItems = dfu.parseRequest(request);
> >>            Iterator iter = fileItems.iterator();
> >>            while (iter.hasNext())
> >>            {
> >>                FileItem item = (FileItem) iter.next();
> >>                if (item.isFormField())
> >>                {
> >>                    //pass along to render request
> >>                    String fieldName = item.getFieldName();
> >>                    String value = item.getString();
> >>                    response.setRenderParameter(fieldName, value);
> >>                }
> >>                else
> >>                {
> >>                    //write the uploaded file to a new location
> >>                    String fieldName = item.getFieldName();
> >>                    String fileName = item.getName();
> >>                    String contentType = item.getContentType();
> >>                    long size = item.getSize();
> >>                    response.setRenderParameter("size",
> >>Long.toString(size));
> >>
> >>response.setRenderParameter("contentType", contentType);
> >>                    String tempDir =
> >>System.getProperty("java.io.tmpdir");
> >>                    System.out.println("tempDir: "+tempDir);
> >>                    String serverFileName = fieldName +
> >>"-portlet.tmp";
> >>                    File serverFile = new File(tempDir,
> >>serverFileName);
> >>                    item.write(serverFile);
> >>                    response.setRenderParameter("serverFileName",
> >>                        serverFileName);
> >>                    getPortletContext().log(
> >>                        "serverFileName : " + tempDir + "/" +
> >>serverFileName);
> >>                }
> >>            }
> >>
> >>Once i submit the multipart form, it does not enter the while
> >>loop meaning
> >>that the iterator is empty.  Is this a bug?
> >>
> >>I attached the rest of the source code. got this from one of
> >>the messages in
> >>this mailing list.
> >>
> >>Thanks,
> >>Nik
> >>
> >>
> >>
> >>
> >>
> >>
> >>--
> >>No virus found in this outgoing message.
> >>Checked by AVG Anti-Virus.
> >>Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2/22/2005
> >>
> >>
> >>
> >>--
> >>No virus found in this incoming message.
> >>Checked by AVG Anti-Virus.
> >>Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2/22/2005
> >>
> >>
> >>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2/22/2005
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2/22/2005



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

Reply via email to