Hi y'all
I'm facing a problem and even after searching SDN for hours I was not able to find a solution.
created an iView, with standard upload UI element, where files should be uploaded.
Accessing KM works fine! Upload seams to work as well but files always have 1k size and when downloading e.g. a word file word reports format error and file is only containing 1 character.
Here is the code I'm using:
try{
String path = wdContext.currentContextElement().getCurrentFolder() + wdContext.currentContextElement().getKMFolder();
ResourceContext context = new ResourceContext(getEP5User());
RID rid = RID.getRID(path);
IResourceFactory factory = ResourceFactory.getInstance();
ICollection folder = (ICollection) factory.getResource(rid,context);
String fileName = wdContext.currentFileElement().getFileresource().getResourceName();
InputStream inputStream = wdContext.currentFileElement().getFileresource().read(false);
File destfile = new File(fileName);
FileOutputStream out = new FileOutputStream(destfile);
if (inputStream != null)
{
out.write(inputStream.read());
}
BufferedInputStream bufInStream = new BufferedInputStream(new FileInputStream(destfile));
Content con = new Content(bufInStream, "text/plain", -1);
IResource newResource = folder.createResource(fileName, null, con);
}catch (Exception e){
Anyone any idea?
Thanks for help!
Christian