Imagine scene:<br><br>I have html form:<br><form action="recordPhoto.jsp" method="POST"><br> <label>*Name for photo:</label><br> <input name="txtName" id="txtName" type="text" /><br>
<br><br> <label>Photo:</label><br> <input name="uploadPhoto" type="file" /><br> <input name="Send" value="Send" type="submit'><br>
</form><br><br>And my recordPhoto.jsp:<br><br> String userCurrent = cms.getRequestContext().currentUser().getName().toString();<br> if(userCurrent.equals("Guest")){<br> cmsObject.loginUser("userforphotos", "userforphotos");<br>
}<br> CmsProject cmsproject = cmsObject.readProject("Offline");<br> cmsObject.getRequestContext().setCurrentProject(cmsproject);<br> cmsObject.getRequestContext().setSiteRoot("/myproject/");<br>
<br>String Photo = null;<br>String Name = "";<br>try{<br> Photo = (String)request.getAttribute("uploadPhoto");<br> }catch(Exception exp){<br> Photo = "/";<br> }<br><br>Locale locale = new java.util.Locale("en");<br>
try{<br>CmsXmlContentDefinition cd = CmsXmlContentDefinition.unmarshal(cmsObject, "/system/modules/my.project/schema/myPhoto.xsd");<br>CmsXmlContent xmlcontent = CmsXmlContentFactory.createDocument(cmsObject,locale,org.opencms.main.OpenCms.getSystemInfo().getDefaultEncoding(),cd);<br>
<br>xmlcontent.getValue("Name", Locale.ENGLISH).setStringValue(cmsObject, String.valueOf(Name));<br>xmlcontent.getValue("Photo", Locale.ENGLISH).setStringValue(cmsObject, String.valueOf(Photo));<br>byte[] content = xmlcontent.marshal();<br>
<br>String folder = "/myPhotos/";<br><br><br> String nameFile = "testPhoto.html";<br> cmsObject.createResource(folder + nameFile, org.opencms.main.OpenCms.getResourceManager().getResourceType("xmlcontent").getTypeId(),content,new ArrayList());<br>
<br>// NOW I NEED STORE IN FOLDER "/myPhotos/" the photo send via RequestHTTP, how can this is? Store binary send request form?<br> }<br><br>You can imagine one suggest/alternative/way for i can success for store file send extern in put opencms?<br>
<br>Thank biggers, KR,<br><br>Deivs<br>