on 11-13-2008 8:42 AM
Hi all,
I had a requirement where i need to download the file which is uploaded by me.
I will explain the things what i have done for uploading.
I have taken a File Upload UI Element.
and binded it with 2 attributes.
this 2 attributes are under the node upload
attr1->string
attr2->binary
1st one is binded to file name property.
2nd one is binded to data property.
WDDOINIT
PrivateWordAppView.IUploadElement Element = wdContext.createUploadElement();
wdContext.nodeUpload().bind(Element);
IWDModifiableBinaryType type = (IWDModifiableBinaryType) wdContext.nodeUpload().getNodeInfo().getAttribute(IPrivateWordAppView.IUploadElement.ATTR2).getModifiableSimpleType();
and i have taken a button upload in the action of the button i have written the following code
String file = wdContext.nodeUpload().currentUploadElement().getAttr1();
String filename = file;
File destinationFile = new File(filename);
FileOutputStream out = new FileOutputStream(destinationFile);
out.write(wdContext.nodeUpload().currentUploadElement().getAttr2());
String path = destinationFile.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
the path of the file stored ion the server is
/usr/sap/EPD/JC50/j2ee/cluster/server1/<uploaded file name>
Now i want to download the same file from the server.
can any one let me know how to write the code.
Thanks & regards,
Lokesh
Hi,
Did you check this tutorial?
Regards,
Harini S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can refer this PDF for file download. This is working fine for me.
I hope this may also help you.
thanx.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
FileDownload:- With the FileDownload element, the user can download a file. Depending on the selected setting
of the behaviour property, the user can open the file or store it on the local hard disk.
The data source, that is the file to be downloaded is determined by the resource property. To be able to load a
file into the context with the FileDownload element, you need the WDResourceFactory. Insert the following code
into the wdDoInit method:
IWDResource resource = WDResourceFactory.createResource(new byte[<number of bytes>], "<name of the file>",WDWebResourceType.<type of the file>);
wdContext.currentUiResourceElement().setResource(resource);
currentUiResourceElement depicts the context node under which you have created the value attribute resource of type Resource.
Find more details here: http://help.sap.com/saphelp_nw2004s/helpdata/en/c8/32cc6922fb6040a768652aaa0b6879/frameset.htm and in the link posted above.
Rgds,
Anagha
Edited by: Anagha Jawalekar on Nov 13, 2008 9:59 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.