Rodrigo Mansho wrote:
Thanks, but when I wanna put a image or document .pdf, I used this code:
FooDocument fooDocument = new FooDocument("with image");
Reader fu = new Reader("image.gif");
//*
public Reader(String fileName) throws FileNotFoundException{ constructor
this(new File(fileName));
}
*//
byte [] byteArray = fu.getBytes();
fooDocument.addAttachment("testiagem", new Attachment("image/gif",
byteArray));
and when i get this document, this document is wrong. Anybody know why
occurs this wrong?
(First of all.. You are using jcouchdb and not couchdb4j, aren't you?)
I'm not sure I understand your problem fully..
Do you create the document in the database?
e.g.
Reader fu = new Reader("image.gif");
byte [] byteArray = fu.getBytes();
FooDocument fooDocument = new FooDocument("with image");
fooDocument.addAttachment(
"test",
new Attachment("image.gif", byteArray));
Database db = new Database("localhost", "testDatabase");
db.createDocument(fooDocument);
Regards,
Sven Helmberger