Ahh, you don't have to process the request at all, it is all done for you
already when auto upload is true.
Just get everything from the parameter parser immediately. You can start
with:
FileItem myItem = data.getParameters().getFileItem("local_file");
> -----Original Message-----
> From: Hervé Guidetti [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 26, 2001 9:58 AM
> To: Turbine
> Subject: Re: ParameterParser with multipart/form-data
>
>
>
> At the begining of the UploadFile action, the parameter
> Parser is already
> empty.
>
> This is my code :
>
> public void uploadFile(RunData data, String subDirectory)
> throws Exception
> {
>
> // upload the file
> String imageroot =
> TurbineResources.getString("services.TurbineUploadService.repo
> sitory");
> String path = imageroot + "/" + subDirectory;
> if (!data.getRequest().getContentType().startsWith(Form.ENC_UPLOAD))
> {
> readInputStream(data);
> data.addMessage("This action requires input of type:
> multipart/from-data.
> The data type is " + data.getRequest().getContentType() + ".
> No further
> action was performed.");
> return;
> }
>
> // Default max file size.
> int maxSize = TurbineUpload.getSizeMax();
> if (data.getRequest().getContentLength() > maxSize)
> {
> readInputStream(data);
> data.addMessage("File is too large. Upload cancelled.");
> return;
> }
> TurbineUpload.parseRequest(data.getRequest(),
> data.getParameters(), path);
> FileItem myitem = null;
> myitem = data.getParameters().getFileItem("local_file");
> String fileName =
> com.idbsoft.kit.util.FileUtil.getName(myitem.getFileName());
> myitem.getStoreLocation().renameTo(new File(path + "/" + fileName));
> }
>
>
>
> > Yes, we are doing this, haven't had a problem. Maybe the
> source for the
> > UpLoadFile action would help, your form looks good.
> >
> > > -----Original Message-----
> > > From: Hervé Guidetti [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, January 26, 2001 9:19 AM
> > > To: Turbine
> > > Subject: ParameterParser with multipart/form-data
> > >
> > >
> > > Hi,
> > >
> > > I use the TDK1.1a9.
> > > I use services.TurbineUploadService.automatic=true
> > >
> > > I want to upload a file using multipart/form-data method and
> > > TurbineUploadService. It works fine.
> > > But I also want to havea description of the file. I try to
> > > have everything
> > > in the same form but I can't retrieve the "description"
> parameter with
> > > data.getParameters().getString("description"). In fact it
> is empty.
> > >
> > >
> > >
> > > This is my template :
> > >
> > > <FORM action="/action/UpLoadFile/" method="post"
> > > enctype="multipart/form-data">
> > > <table>
> > > <tr>
> > > <td>
> > > Select a file
> > > </td>
> > > <td>
> > > <input name="local_file" type="FILE" >
> > > </td>
> > > </tr>
> > > <tr>
> > > <td>
> > > Description
> > > </td>
> > > <td>
> > > <INPUT name="description" type="text" value="">
> > > </td>
> > > </tr>
> > > </table>
> > > <INPUT type="submit" value="Upload File with description">
> > > </form>
> > >
> > >
> > > Is it possible to retrieve parameters when using
> multipart/form-data ?
> > > If yes, how ?
> > >
> > > Thanks for your time.
> > > Hervé
> > >
> > >
> > >
> > >
> > > ------------------------------------------------------------
> > > To subscribe: [EMAIL PROTECTED]
> > > To unsubscribe: [EMAIL PROTECTED]
> > > Search:
<http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> > Problems?: [EMAIL PROTECTED]
> >
>
>
> -----------------------------------------------------------------------
>
> This message has been scanned for viruses with Trend Micro's Interscan
VirusWall.
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]
-----------------------------------------------------------------------
This message has been scanned for viruses with Trend Micro's Interscan VirusWall.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]