sulokarthi
iPF Noob
- Joined
- Jan 19, 2012
- Messages
- 1
- Reaction score
- 0
Hi I was trying to download a .csv file from my web application using Content-Disposition
here is my code
response.setContentType("application/octet-stream");
}
filename = filename.concat(downloadType);
response.setHeader("Content-Disposition","attachment; filename="+filename+";");
//response.setHeader("Content-Disposition","application/octet-stream; filename="+filename+";");
String source = (String)ivHttpRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")) {
source = Utils.decodeHtmlEntities(source);
}
byte [] byteArray;
if(source == null)
{
// use ivRequest instead
String source2 = (String)ivRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")){
source2 = Utils.decodeHtmlEntities(source2);
}
byteArray = source2.getBytes();
}
else
{
byteArray = source.getBytes();
}
ServletOutputStream out = response.getOutputStream();
out.write(byteArray);
out.close();
I'm able to download the file in all the browsers, But while using IPAD the content of the file replaces the existing window (Parent Window) without asking for Save or Open
Please let me know is there any special content type or anythinmg else i have to chanage..
THe problem i faced only with IPAD
here is my code
response.setContentType("application/octet-stream");
}
filename = filename.concat(downloadType);
response.setHeader("Content-Disposition","attachment; filename="+filename+";");
//response.setHeader("Content-Disposition","application/octet-stream; filename="+filename+";");
String source = (String)ivHttpRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")) {
source = Utils.decodeHtmlEntities(source);
}
byte [] byteArray;
if(source == null)
{
// use ivRequest instead
String source2 = (String)ivRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")){
source2 = Utils.decodeHtmlEntities(source2);
}
byteArray = source2.getBytes();
}
else
{
byteArray = source.getBytes();
}
ServletOutputStream out = response.getOutputStream();
out.write(byteArray);
out.close();
I'm able to download the file in all the browsers, But while using IPAD the content of the file replaces the existing window (Parent Window) without asking for Save or Open
Please let me know is there any special content type or anythinmg else i have to chanage..
THe problem i faced only with IPAD