[opencms-dev] Upload a file with a java class

Irene Santerini i.santerini at inera.it
Tue Sep 23 17:03:01 CEST 2003


Hi Jef,

Yes, it's possibile. You can use the method:

--> getFile
----------------------------------------------------------------------------
-----------------------------------------------
public byte[] getFile(java.lang.String name)

Returns the content of an uploaded file.
Returns null if no file with this name has been uploaded with this request.
Returns an empty byte[] if a file without content has been uploaded.
Parameters:
name - The name of the uploaded file.
Returns:
The selected uploaded file content.

----------------------------------------------------------------------------
-----------------------------------------------
My Java class:
...................

public byte[] getContent(CmsObject cms .......... ) {
...............................
String name_file= (String) parameters.get("name_file");
byte[] file = cms.getRequestContext().getRequest().getFile(name_file);
..................
}

where "name" is the name of the uploaded file.
For ex: <input class="input450" type="file" name="name_file" id="name_file"
value="">

I hope this can help you.
Bye
Irene

----- Original Message ----- 
From: "Biesemans, Jef" <Jef.Biesemans at eu.fishersci.com>
To: <opencms-dev at opencms.org>
Sent: Tuesday, September 23, 2003 4:11 PM
Subject: [opencms-dev] Upload a file with a java class


> Hi,
>
> I'm devoloping a site with OpenCMS. To put files on the site, I would like
to use a Java class. Is it possible to upload a file to OpenCMS with Java.
And if this is possible, what do I have to do.
>
> Sorry for my terrible English, but I hope you can understand what I mean.
>
> Best regards,
> Jef
>
>
>     The information contained in this message is confidential and is
intended for the addressee only
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>




More information about the opencms-dev mailing list