on 07-23-2007 8:21 AM
Hi experts
I am facing a problem while Downloading File from the server.
I am trying to DownLoad a Excel FIle.
When i am clicking on the FileDownLoad Link,It is showing option for save,open
and after saving ,when i am trying to open the file,It is showing in a dilog box"Un able to read file".
Can u please tell me what can be the problem and how to solve this?
Thanks
Salini
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
use this for file download.
For file down load u have to use a UI element as "File download".
u just create context attribute as setdownload_res and file data.
setdownload_res as of type "com.sap.ide.webdynpro.uielementdefinitions.Resource" then bound it to the ui element "resource".
file data as of type "com.sap.tc.webdynpro.progmodel.api.IWDInputStream"
and set calcuclated as true and read only as true.
then in doinit method u just write this code
IWDAttributePointer attr = wdContext.currentContextElement().getAttributePointer("fileData");
IWDResource res = WDResourceFactory.createResource(attr,null,WDWebResourceType.UNKNOWN);
wdContext.currentContextElement().setDownload_res(res);
wdComponentAPI.getMessageManager().reportSuccess(""+c);
after this in the getter method u write this code
IWDInputStream stream = null;
try
{
stream = WDResourceFactory.createInputStream(new FileInputStream(new File("<pathof the file to be download>")));
}
catch(Exception e)
{
e.printStackTrace();
}
return stream;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satish
Thanks for your response.
Hope it is helping me.
Can u please clarify one thing,inside the getter method while creating an instance of IWDInputStream the path to the File to be downloaded means ,the path of the File in the Application Server or Presentation Server?
If it is Application Server ,then How can i get the path where it is storing the File?
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.