<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1264" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Matthew,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>you can find the explanation and solution
here:</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://mail.opencms.org/pipermail/opencms-dev/2003q4/007488.html">http://mail.opencms.org/pipermail/opencms-dev/2003q4/007488.html</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Bye,</FONT></DIV>
<DIV><FONT face=Arial size=2>Stephan</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=matte@solidstategroup.com
href="mailto:matte@solidstategroup.com">Matthew Evans</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=opencms-dev@opencms.org
href="mailto:opencms-dev@opencms.org">opencms-dev@opencms.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, October 24, 2003 3:45
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [opencms-dev] Writing images to
the CMS (code attached)</DIV>
<DIV><BR></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>