<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1264" name=GENERATOR></HEAD>
<BODY>
<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></BODY></HTML>