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 "J.Enrique Ruiz-Valenciano" <je...@gmail.com> on 2007/03/21 21:22:16 UTC

Re: jetspeed with file upload - multipart

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().getRealPath("/")+"uploadedFiles/"+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


RE: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
Hi, it used somehow the common.fileupload 1.0, but now I have put the 1.2 jar directly with the code in stead of in tomcat/commons/lib directory and it works better (recognizes the isMultiPartForm).
 
But now List /* FileItem */ items = upload.parseRequest(aReq); goes wrong.
I tried using FileItemFactory, DiskFileItemFactory, PortletFileUpload(factory) with and without factory and List<FileItem> items, List items.
 
The tomcat log only shows: 
[org.apache.ojb.broker.core.PersistenceBrokerImpl] WARN: No running tx found, please only store in context of an PB-transaction, to avoid side-effects - e.g. when rollback of complex objects
But I am not sure if it is related to the problem.
 
Please help!!!!
 
import java.io.*;
import java.util.Iterator;
import java.util.List;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.portlet.PortletFileUpload;
 
...........
 
       public void processAction(ActionRequest aReq, ActionResponse aRes)throws PortletException, IOException {
 
         DiskFileItemFactory factory = new DiskFileItemFactory();
         PortletFileUpload upload = new PortletFileUpload(factory);
         boolean isMultiPart = upload.isMultipartContent(aReq);              
         if (isMultiPart){
            try {
                List /* FileItem */ items = upload.parseRequest(aReq);
                ...................

________________________________

Van: Patrick Duin [mailto:p.duin@hippo.nl]
Verzonden: do 22-3-2007 17:27
Aan: Jetspeed Users List
Onderwerp: 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




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


Re: jetspeed with file upload - multipart

Posted by "J.Enrique Ruiz-Valenciano" <je...@gmail.com>.
Erik, you have the source code, you can debug it.

> yes, apache commons file upload 1.2.jar
>  
> Thank you
>
>  
> ________________________________
>
> Van: Aaron Evans [mailto:aaronmevans@gmail.com]
> Verzonden: do 22-3-2007 19:40
> Aan: Jetspeed Users List
> Onderwerp: Re: jetspeed with file upload - multipart
>
>
>
> Hey,
> I assume you are using a 3rd party jar for the file upload piece? What
> is it, commons-file-upload?
>
> thx,
> aaron
>
> On 3/22/07, Patrick Duin <p....@hippo.nl> wrote:
>   
>> 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


Re: jetspeed with file upload - multipart

Posted by Aaron Evans <aa...@gmail.com>.
Thanks for the udpate!

On 4/12/07, e.j.w.vanbloem@student.utwente.nl
<e....@student.utwente.nl> wrote:
> Allmost forgot to post that I found the sollution.
>
> not only do you have to be carefull not to have an old version of the commons-fileupload
> I now use commons-fileupload-1.2.jar
>
> I did not know this but it makes also use of commons-io, and Jetspeed came with an old version of this.
> I used commons-io-1.3.1.jar and that works well
>
> ________________________________
>
> Van: e.j.w.vanbloem@student.utwente.nl [mailto:e.j.w.vanbloem@student.utwente.nl]
> Verzonden: do 22-3-2007 20:08
> Aan: jetspeed-user@portals.apache.org
> Onderwerp: RE: jetspeed with file upload - multipart
>
>
>
> yes, apache commons file upload 1.2.jar
>
> Thank you
>
>
> ________________________________
>
> Van: Aaron Evans [mailto:aaronmevans@gmail.com]
> Verzonden: do 22-3-2007 19:40
> Aan: Jetspeed Users List
> Onderwerp: Re: jetspeed with file upload - multipart
>
>
>
> Hey,
> I assume you are using a 3rd party jar for the file upload piece? What
> is it, commons-file-upload?
>
> thx,
> aaron
>
> On 3/22/07, Patrick Duin <p....@hippo.nl> wrote:
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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


RE: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
Allmost forgot to post that I found the sollution.
 
not only do you have to be carefull not to have an old version of the commons-fileupload
I now use commons-fileupload-1.2.jar
 
I did not know this but it makes also use of commons-io, and Jetspeed came with an old version of this.
I used commons-io-1.3.1.jar and that works well

________________________________

Van: e.j.w.vanbloem@student.utwente.nl [mailto:e.j.w.vanbloem@student.utwente.nl]
Verzonden: do 22-3-2007 20:08
Aan: jetspeed-user@portals.apache.org
Onderwerp: RE: jetspeed with file upload - multipart



yes, apache commons file upload 1.2.jar

Thank you


________________________________

Van: Aaron Evans [mailto:aaronmevans@gmail.com]
Verzonden: do 22-3-2007 19:40
Aan: Jetspeed Users List
Onderwerp: Re: jetspeed with file upload - multipart



Hey,
I assume you are using a 3rd party jar for the file upload piece? What
is it, commons-file-upload?

thx,
aaron

On 3/22/07, Patrick Duin <p....@hippo.nl> wrote:
> 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
>
>

---------------------------------------------------------------------
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


RE: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
yes, apache commons file upload 1.2.jar
 
Thank you

 
________________________________

Van: Aaron Evans [mailto:aaronmevans@gmail.com]
Verzonden: do 22-3-2007 19:40
Aan: Jetspeed Users List
Onderwerp: Re: jetspeed with file upload - multipart



Hey,
I assume you are using a 3rd party jar for the file upload piece? What
is it, commons-file-upload?

thx,
aaron

On 3/22/07, Patrick Duin <p....@hippo.nl> wrote:
> 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
>
>

---------------------------------------------------------------------
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


Re: jetspeed with file upload - multipart

Posted by Aaron Evans <aa...@gmail.com>.
Hey,
I assume you are using a 3rd party jar for the file upload piece? What
is it, commons-file-upload?

thx,
aaron

On 3/22/07, Patrick Duin <p....@hippo.nl> wrote:
> 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
>
>

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


FW: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
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


RE: jetspeed with file upload - multipart

Posted by Bhaskar Roy <bh...@chikpea.com>.
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


RE: jetspeed with file upload - multipart

Posted by Patrick Duin <p....@hippo.nl>.
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


RE: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
Hi,
 
I already changed it but it still does not work.
When the actionRequest is used by portletfileupload it does not go further, but also give no error.
PortletFileUpload.isMultipartContent(request);

Does someone have it working? And if so, how?
 
Regards Erik

________________________________

Van: Melchior, Joris [mailto:Joris.Melchior@fmr.com]
Verzonden: do 22-3-2007 15:24
Aan: Jetspeed Users List
Onderwerp: RE: jetspeed with file upload - multipart



One of us needs reading glasses I think ...

To me it looks like the form you gave as an example uses
'ENCRYPT="multipart/form-data"'. The responder gives a sample that says
"enctype='multipart/form-data'". That's different as far as I can tell.

Cheers, Joris.

-----Original Message-----
From: e.j.w.vanbloem@student.utwente.nl
[mailto:e.j.w.vanbloem@student.utwente.nl]
Sent: Thursday, March 22, 2007 4:28 AM
To: jetspeed-user@portals.apache.org
Cc: jenrique.ruiz@gmail.com
Subject: FW: jetspeed with file upload - multipart

Thank you,

But as you can see I am already using the enctype. Other ideas?


________________________________

Van: J.Enrique Ruiz-Valenciano [mailto:jenrique.ruiz@gmail.com]
Verzonden: wo 21-3-2007 21:22
Aan: Jetspeed Users List
Onderwerp: Re: jetspeed with file upload - multipart



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().getRealPath("/")+"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


RE: jetspeed with file upload - multipart

Posted by "Melchior, Joris" <Jo...@fmr.com>.
One of us needs reading glasses I think ... 

To me it looks like the form you gave as an example uses
'ENCRYPT="multipart/form-data"'. The responder gives a sample that says
"enctype='multipart/form-data'". That's different as far as I can tell.

Cheers, Joris.

-----Original Message-----
From: e.j.w.vanbloem@student.utwente.nl
[mailto:e.j.w.vanbloem@student.utwente.nl] 
Sent: Thursday, March 22, 2007 4:28 AM
To: jetspeed-user@portals.apache.org
Cc: jenrique.ruiz@gmail.com
Subject: FW: jetspeed with file upload - multipart

Thank you,
 
But as you can see I am already using the enctype. Other ideas?
 

________________________________

Van: J.Enrique Ruiz-Valenciano [mailto:jenrique.ruiz@gmail.com]
Verzonden: wo 21-3-2007 21:22
Aan: Jetspeed Users List
Onderwerp: Re: jetspeed with file upload - multipart



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().getRealPath("/")+"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


FW: jetspeed with file upload - multipart

Posted by e....@student.utwente.nl.
Thank you,
 
But as you can see I am already using the enctype. Other ideas?
 

________________________________

Van: J.Enrique Ruiz-Valenciano [mailto:jenrique.ruiz@gmail.com]
Verzonden: wo 21-3-2007 21:22
Aan: Jetspeed Users List
Onderwerp: Re: jetspeed with file upload - multipart



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().getRealPath("/")+"uploadedFiles/"+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