10-01-2009 09:31 AM
// Open the file and convert to byte array
InputStream viewStream = newContentNode.getClass().getClassLoader().getResourceAsStream("test.jpg");
byte[] bytes = null;
try
{
bytes = ContentUtils.convertToByteArray(viewStream);
}
catch (Exception e)
{
…
}
// Write the content
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
Content contentRef = null;
try
{
contentRef = contentService.write(newContentNode, Constants.PROP_CONTENT, bytes, format);
}
catch (ContentFault e)
{
…
}
catch (RemoteException e)
{
…
}
My problem is that the file test.jpg is in the same folder as the class. But I want to upload files from another folder.
InputStream viewStream = newContentNode.getClass().getClassLoader().getResourceAsStream("../../../../../TempFolder/test.jpg");
10-01-2009 11:07 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.