Hello list, I'm having a problem with the file download. I'd like to be able to have the name of the file show up in the save as box, but right now I'm getting the webobjects form id instead. This is on any windows browser: Firefox, or IE 7. Any ideas? Thanks, Yury
Here's my code:
public void appendToResponse(WOResponse r, WOContext c) { // super.appendToResponse(r, c); if(proof != null && proof.pdfPath().length() > 0) { File f = new File(Application.PROOFSDIR + File.separator + proof.pdfPath()); try { NSData resultData = new NSData(new FileInputStream(f), (int)f.length()); if(resultData != null) { r.disableClientCaching(); r.removeHeadersForKey("Cache-Control"); r.removeHeadersForKey("pragma"); r.setHeader("application/pdf", "content-type"); r.setHeader("inline; filename=\"" + Application.PROOFSDIR + proof.pdfPath() + "\"", "content-disposition"); r.setHeader(Integer.toString(resultData.length()), "content-length"); r.setContent(resultData); } } catch(Exception e) { } } } |