thanks Alexander. Regards Vishal Nayak
-----Opprinnelig melding----- Fra: Alexander Klimetschek [mailto:[EMAIL PROTECTED] Sendt: 15. oktober 2008 14:15 Til: [email protected] Emne: Re: Jackrabbit examples for File Upload and download Because I already mentioned Sling (which simplifies a lot when developing web applications on top of JCR), here is a blog entry about how to do custom file uploading in Sling (it works out of the box with standard html form posting, but often you might want to add metadata based on the file content): http://dev.day.com/microsling/content/blogs/main/fileuploadsinsling.html Regards, Alex On Wed, Oct 15, 2008 at 12:38 AM, Alexander Klimetschek <[EMAIL PROTECTED]> wrote: > Hi, > > here is some code snippet, completely plain JCR API, leaving out the > servlet request file uploading part, since this is not part of > Jackrabbit but of your preferred web application framework (you might > want to take a look at Apache Sling [1]). I suggest to read the JCR > spec [2], which is the one-and-only documentation on JCR (and its well > readable for a standard). > > ------ > > InputStream fileStream = ... // get the stream from your web app > framework String fileName = ... // get a filename from the request or > generate it > > Node folder = session.getRootNode().getNode("path/to/file/uploads"); > Node file = folder.addNode(fileName, "nt:file"); Node fileContent = > file.getNode("jcr:content"); fileContent.setProperty("jcr:data", > fileStream); session.save(); > > ------ > > [1] http://incubator.apache.org/sling/ > [2] http://jcp.org/en/jsr/detail?id=170 > > Regards, > Alex > > On Tue, Oct 14, 2008 at 3:24 PM, Nayak Vishal <[EMAIL PROTECTED]> wrote: >> >> Hello guys, >> >> Does anyone of you have Jackrabbit sample code or examples for File >> Upload and file download. >> >> Regards >> Vishal Nayak >> > > > > -- > Alexander Klimetschek > [EMAIL PROTECTED] > -- Alexander Klimetschek [EMAIL PROTECTED]
