[opencms-dev] Write a file into the VFS

Alexander Kandzior alex at opencms.org
Thu Aug 7 17:24:00 CEST 2003


Try this:

--------------
com.opencms.file.CmsObject cms;
// must be initialized somehow, e.g. with
CmsJspActionElement.getCmsObject()

String foldername = "/Test/";
String filename = "text.txt";
int type = 3; // 1 = page, 3 = plain, 5 = binary, 8 = jsp

CmsFile newfile = (CmsFile)cms.createResource(foldername, filename,
type);
--------------


Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

> -----Original Message-----
> From: opencms-dev-admin at opencms.org 
> [mailto:opencms-dev-admin at opencms.org] On Behalf Of ambiesense at gmx.de
> Sent: Thursday, August 07, 2003 4:45 PM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] Write a file into the VFS
> 
> 
> Hi,
> 
> can somebody provide a code example of how to write a file 
> into the VFS of OpenCMS?
> 
> CmsFile myFile = new CmsFile("/Test/test.txt");
> 
> Would be my wish. However the constructor asks for many IDs 
> and additional information. I understand that this is 
> necessary in order to privde consistency within the system. 
> However I do not know how to get this id's and flags from the 
> position where I want to put the file.
> 
> Is the parentID the id of the directory?
> What are the resourceFlags?
> 
> I think one short exampe from an expert here in this forum 
> whould help resolving a lot of problems. 
> 
> Thank you,
> Ralf
> 
> -- 
> COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
> --------------------------------------------------
> 1. GMX TopMail - Platz 1 und Testsieger!
> 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
> 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. 
> daybyday - 8. e-Post
> 
> _______________________________________________
> 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