You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by e....@student.utwente.nl on 2007/04/02 08:53:55 UTC

FW: jetspeed with file upload - multipart

How did you solve it?
Do I understand it right, that jetspeed 2 does not send the multipart in the actionrequest?
If so, is there a difference between 2.0 and 2.1?
 
If you or someone else from this list has an idea then I like to hear it.
 
Regards,
 
Erik

________________________________

Van: Bhaskar Roy [mailto:bhaskar.roy@chikpea.com]
Verzonden: vr 30-3-2007 18:53
Aan: 'Jetspeed Users List'
Onderwerp: RE: jetspeed with file upload - multipart



I tried file upload in portlets, didn't work in j2.0, not sure about 2.1

Regards,
Bhaskar Roy
www.chikpea.com
Sales & Service Exchange Portal

-----Original Message-----
From: Patrick Duin [mailto:p.duin@hippo.nl]
Sent: Thursday, March 22, 2007 9:58 PM
To: Jetspeed Users List
Subject: RE: jetspeed with file upload - multipart

Hi Erik,
We are using:
        FileItemFactory factory = new DiskFileItemFactory();
        PortletFileUpload upload = new PortletFileUpload(factory);
        items = upload.parseRequest(request);

So PortletFileUpload instead of your DiskFileUpload, maybe it helps.

Cheers,
        Patrick.


>
> I think your error is in the ENCRYPT attribute, this
> attribute doesn't exist in the FORM element
> (http://www.w3.org/TR/html401/interact/forms.html). You must
> use the attribute ENCTYPE. For example:
>
> <form method='post' name='fileForm' action='<portlet:actionURL />'
> enctype='multipart/form-data'>
>
> > I am trying to upload a jpg form a form.
> > But when I run it it does not give an error, but I know it
> does not go
> further then when I do something with the request. (check if
> it is multipart, and when I delete this it holds at putting
> it in items)
> > I am busy with this for more than 2 day so please help <form
> > method="POST" ENCRYPT="multipart/form-data"
> action="<portlet:actionURL />" >
> >  <input type="file" name="photo">
> >  <input type="SUBMIT" name="button" value="upload"> </form>
> >
> > import org.apache.commons.fileupload.portlet.PortletFileUpload;
> > import org.apache.commons.fileupload.*;
> >
> > import javax.portlet.*;
> >
> > public void processAction(ActionRequest request, ActionResponse
> response) throws PortletException, IOException {
> >  boolean isMultiPart =
> PortletFileUpload.isMultipartContent(request);
> >  if (isMultiPart){
> >   DiskFileUpload diskUpload = new DiskFileUpload();
> >
> >      List items = null;
> >      items = upload.parseRequest(request);
> >
> >      Iterator itr = items.iterator();
> >      while (itr.hasNext()) {
> >       FileItem item = (FileItem) itr.next();
> >       if (item.isFormField()) {
> >       } else {
> >        String itemName = item.getName();
> >        File savedFile = new
> File(request.getPortletSession().getPortletContext().getRealPa
> th("/")+"u
> ploadedFiles/"+itemName);
> >        item.write(savedFile);
> >       }
> >      }  
> >  }
> > }
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 3/22/2007
7:44 AM



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org