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]

Reply via email to