<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Nachricht</TITLE>
<META content="MSHTML 6.00.2800.1264" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=265515513-24102003><FONT face=Arial color=#0000ff
size=2>Matthew,</FONT></SPAN></DIV>
<DIV><SPAN class=265515513-24102003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=265515513-24102003><FONT face=Arial color=#0000ff size=2>you
should change to an offline project before writing to the OpenCms VFS. Use
"<FONT size=2>cmso.getRequestContext().setCurrentProject(projectId)" to do so.
Get the project ID from the source code of the head frame of the OpenCms
workplace.</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=265515513-24102003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=265515513-24102003><FONT size=2>Regards,<BR><BR>Andreas
Zahner<BR>Alkacon Software - The OpenCms Experts<BR><A
href="http://www.alkacon.com/">http://www.alkacon.com</A> </FONT></DIV></SPAN>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B>
opencms-dev-admin@opencms.org [mailto:opencms-dev-admin@opencms.org] <B>Im
Auftrag von </B>Matthew Evans<BR><B>Gesendet:</B> Freitag, 24. Oktober 2003
14:45<BR><B>An:</B> opencms-dev@opencms.org<BR><B>Betreff:</B> [opencms-dev]
Writing images to the CMS (code attached)<BR><BR></FONT></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>Hi
all,</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>I have been
working on this bug for about 4 days now, and it's driving me
nuts.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>I've tried to
follow all the tutorials and information I can find, but it keeps coming back
with errors.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>I'm trying to
simply write an image to the CMS. I've simplified my code in order to debug,
and this is what I have now.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>Anyone should be
able to run this, just dump it in a jsp file, it loads the login image and
saves it out as test.gif.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>Well, thats what
it should do, but I keep getting this error:</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003>com.opencms.core.CmsException: 1 Access
denied. Detailed error: [com.opencms.file.mySql.CmsResourceBroker]
/system/login/test.gif. </SPAN></DIV>
<DIV><SPAN class=171104113-24102003></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>Any help would be
extremely appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2>M@.</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2>------------------------------- code
----------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2><%@ page
session="false" %><BR><%@ taglib prefix="cms" uri="<A
href="http://www.opencms.org/taglib/cms">http://www.opencms.org/taglib/cms</A>"
%><BR><%@ page
import="java.util.*,<BR>
com.opencms.flex.jsp.*,<BR>
com.opencms.file.*,<BR>
com.opencms.core.CmsException" %></FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2><%
<BR>//Get command line parameters<BR>String download_dir =
request.getParameter("download_dir");</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>// Create a JSP
action element<BR>com.opencms.flex.jsp.CmsJspActionElement cms = new
com.opencms.flex.jsp.CmsJspActionElement(pageContext, request,
response);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>//Instatiate the
CMSObject<BR>CmsObject cmso = cms.getCmsObject(); <BR>CmsFolder currentFolder
= cmso.readFolder(download_dir);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>//Create
properties hash<BR>Hashtable props = new Hashtable();
<BR>props.put("Title","Test"); <BR>props.put("Description","Thumbnail for
Test"); </FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial
size=2>try{</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>
byte[] jpeg =
cmso.readFile("/system/login/login_logo.gif").getContents();<BR>
CmsFile outputResource = (CmsFile)cmso.createResource("/system/login/",
"test.gif", "image", props, jpeg);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>
//Lock the file (should not be needed for new files)<BR>
//cmso.lockResource("/system/login/test.gif");</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>
cmso.writeFile(outputResource);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2>} catch (Exception
main) { out.println(main);}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=171104113-24102003><FONT face=Arial size=2><BR>%>
</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Verdana size=2>Matthew Evans</FONT></DIV>
<DIV align=left><FONT size=2><FONT
face=Verdana><STRONG>Solid</STRONG>State<FONT
color=#808080><STRONG>Group</STRONG></FONT></FONT></FONT></DIV>
<DIV align=left><FONT face=Verdana size=1>tel. +44 (0) 20
77402133</FONT></DIV>
<DIV align=left><FONT face=Verdana size=1>Mob. +44(0)7958 379562</FONT></DIV>
<DIV align=left><FONT face=Verdana><FONT face=Arial size=1><A
href="http://www.solidstategroup.com/">http://www.solidstategroup.com</A></FONT></FONT></DIV>
<DIV> </DIV></BLOCKQUOTE></BODY></HTML>