File download
File download
- Subject: File download
- From: email@hidden
- Date: Tue, 6 Apr 2004 19:37:07 -0700
Hi,
What is the correct way to set the headers in a WOResponse so that the
browser saves the received content to a file on the client machine.
Internet Explorer and Firefox work okay. They create a file on my
desktop called "File.csv". However, Safari still displays the
content in the browser as plain text instead of saving it to a file.
Am I doing something wrong? What am I missing. Here's the code
snippet that sends a string of comma-separated-values to the browser:
public void appendToResponse(WOResponse aResponse, WOContext
aContext) {
aResponse.appendContentString(string);
aResponse.setHeader("text/comma-separated-values",
"Content-Type");
aResponse.setHeader(String.valueOf(string.length()),
"Content-Length");
aResponse.setHeader("attachment; filename=File.csv",
"Content-Disposition");
aResponse.setHeader("File.csv", "filename");
}
Thanks in advance,
Ricardo Parada
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.