Hi Bart,

I use this to upload images. It works fine for me.

try {

File f = new File("/tmp/" + pasNummer + ".jpg");
int fsize = (int)f.length();
byte[] thedata = new byte[fsize];
FileInputStream instream = new FileInputStream(f);
instream.read(thedata);
NodeManager imageItemManager = mmbasecloud.getNodeManager("images");
Node imgNode = imageItemManager.createNode();
imgNode.setValue("title",achterNaam + ", " + voorNaam + ", " +
pasNummer);
imgNode.setValue("handle",thedata);
imgNode.setValue("description","Imported " + (new Date()));
imgNode.commit();

} catch (Exception e) {

out.println("Exception: " + e + " (" + pasNummer + ")");

}

Kind regards,

Henk.

MMatch / MMbase consultancy and implementation
Hommelstraat 9A
NL-3061 VA Rotterdam
T. +31-(0)6-29054903
E. [EMAIL PROTECTED]
I. http://www.mmatch.nl

> -----Original Message-----
> From: Kees Jongenburger [mailto:[EMAIL PROTECTED] On 
> Behalf Of Kees Jongenburger
> Sent: Friday, March 05, 2004 10:19 PM
> To: [EMAIL PROTECTED]
> Subject: RE: importing images
> 
> 
> Hi Bart,
> 
> I am sorry, I tried to give you a quick answer (I had to go 
> the developers meeting)
> 
> I actually don't know if the XML importer is capable of 
> importing binary data.
> 
> The script I sent doesn't work unless you remove the third 
> line of the script "# Kees Jongenburger" and read up on 
> http://www.mmbase.org/docs/backenddevelopers/r> mmci.html to 
> enable rmmci and download beanshell.
> 
> Secondly 
> and I think this is a more "generic" problem while importing 
> larger amounts of data you need to set the node cache to a 
> lower value otherwise you will get OutOfMemmory exception.
> 
> Let me/us know how it goes.
> 
> 
> Kees
> 


Reply via email to