on 11-08-2007 6:37 PM
Hello:
I can't Upload correctly a file from my local PC to a KM of the server.
My problem is after that I've uploaded my selected file to KM, when I open or download it from the KM appears blank. I can't get the file Data of the file for uploading
I use a FileUpload.
____________________
<b>
My Context:
File (node)
|----fileResource (com.sap.ide.webdynpro.uielementdefinitions.Resource)
|----fileData (binary)
|----fileName (String)
</b>
________________________________
wdDoInit(){
IPrivateUploadDownloadKMView.IFileElement fileBind = wdContext.createFileElement();
wdContext.nodeFile().bind(fileBind);
IWDAttributeInfo attInfo = wdContext.nodeFile().getNodeInfo().getAttribute("fileData");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
}
onActionSubir(){
IPrivateUploadDownloadKMView.IFileElement fileElement = wdContext.currentFileElement();
IWDResource resource = fileElement.getFileResource();
fileElement.setFileName(resource.getResourceName());
fileElement.setFileData(fileData);
byte[] fileData=new byte[resource.read(false).available()];
fileElement.setFileData(fileData);
fileName = fileElement.getFileName();
try{
File file = new File(fileName);
FileOutputStream out = new FileOutputStream(file);
out.write(fileElement.getFileData());
out.close();
fin = new FileInputStream(fileName);
fin.read();
Content content = new Content(fin,null, -1);
IResource newResource = folder.createResource(fileElement.getFileName(),null, content);
}
catch(Exception e){
IWDMessageManager mm = wdControllerAPI.getComponent().getMessageManager();
mm.reportWarning("error: "+e.getMessage());
}
}
Can you help me?, any sugestions to solve my problem or improve my code?
Regards
Jonatan.
check this blog
/people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.