Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Download files using af: filedownload listener

SUMITH MAMIDIPELLYNov 22 2023 — edited Nov 22 2023

Hi Team, I'm using jdev 12.2.1.4.0. I have a requirement to download two files ( one pdf and excel file) using file download listener.
Previously I can able to download a single file(pdf) using like below.Now i have to download one more excel file from the path. Is it possible to zip these files and download in one click. please suggest me

String docname ="";
docname="test.pdf";
String fileUploadLoc = (String) op.execute();(will get the path of the file from lookups)
File f = new File(fileUploadLoc + docname);
try {

InputStream in = new FileInputStream(f);
byte[] buf = new byte[1024];
int count;
while ((count = in.read(buf)) >= 0) {
outputStream.write(buf, 0, count);
}
} catch (IOException e) {
//prints exception message and detail of the exception
e.printStackTrace();
logger.error(e.getMessage(), e);

}

Comments
Post Details
Added on Nov 22 2023
1 comment
575 views