<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C3A2F9.A3842A10">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:HyphenationZone>14</w:HyphenationZone>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
span.StileMessaggioDiPostaElettronica17
        {mso-style-type:personal-compose;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 2.0cm 2.0cm 2.0cm;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:"Tabella normale";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=IT link=blue vlink=purple style='tab-interval:35.4pt'>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>I’m trying to create a new
resouce uploding a file. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>But it doesn’t work.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>I’ve used the code
found in the mailing-list archives:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><%<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>CmsObject
cms = ((CmsFlexRequest)request).getCmsObject();<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>CmsRequestContext
reqContext = cms.getRequestContext();<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>out.println(reqContext.currentProject().getId()
+ " " + reqContext.currentProject().getName());<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>   </span><o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>String
localfile = request.getParameter("myfile");<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>String
filename =<span style='mso-spacerun:yes'> 
</span>localfile.substring(localfile.lastIndexOf("\\"),localfile.length());<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>String
type =
filename.substring(filename.lastIndexOf("."),filename.length());<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>String
WORKING_PATH="/mysite/test";<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>cms.loginUser("Admin","admin");<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>reqContext.setCurrentProject(3);<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>cms.lockResource(WORKING_PATH);
//this one doesn’t work. I have to comment it<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><o:p> </o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>CmsRequestHttpServlet
req = (CmsRequestHttpServlet)(reqContext.getRequest());<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>java.util.Enumeration
files = req.getFileNames();<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>while(files.hasMoreElements()){<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>     </span>String this_filename =
(String) files.nextElement();<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>     </span>byte[] filecontent =
req.getFile(this_filename);<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>    
</span>out.println(this_filename);<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>    
</span>cms.createResource(WORKING_PATH, this_filename, "binary",
null,<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'>           </span>filecontent);<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>}<o:p></o:p></span></font></i></p>

<p class=MsoNormal><i style='mso-bidi-font-style:normal'><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB;font-style:italic;mso-bidi-font-style:normal'>%><o:p></o:p></span></font></i></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>Unfortunely, the only
exception i can catch is the JasperException and i cannot understand what is
happen.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>Someone can help me? Urgent,
please.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB;mso-no-proof:yes'> <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB;mso-no-proof:yes'> </span></font><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>

</div>

</body>

</html>