on 09-15-2009 11:16 PM
Hello experts,
I have the following scenario:
A BAPI creates an .exe file and stores it in a custom folder in the server where the portal (and my WD application) is running. This happens once a day.
What I need to do is create a link or button (doesn't matter) so that users can click on it and download this file.
I already checked the file upload - download tutorial (http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f;jsessionid=%28J2EE3417500%29ID0774236150DB11016171821629714331End?overridelayout=true) however this one considers the file to be downloaded is stored in the src folder of the project, thus it doesn't really help me.
How can I achieve this? Any suggestions and help will be greatly appreciated.
Thanks!
hi Alain,
Use File API to read data from the file. It will return byte array from the file. Set Byte array to the file resouce context attribute.
bind this attribute to the filedownload UI element.
Since you need to read file from the same server where webdynpro application is running, You can give the folder path on the server where the file is located.
try {
File inputFile =
new File("C:\\Test\\Test.txt");
FileInputStream in = new FileInputStream(inputFile);
byte b[] = new byte[ inputFile.length()];
in.read(b);
in.close();
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alain,
You can to get file for java,and cast to byte[] and cast to Resource by byte[],so you can run "IWDResource.download()" to get file for IE.
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.