• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
File download
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: File download
      • From: Chuck Hill <email@hidden>
    • Re: File download
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: .eomodeld~ directory and CVS: annoying problems
  • Next by Date: Re: File download
  • Previous by thread: Re: documentation pointer
  • Next by thread: Re: File download
  • Index(es):
    • Date
    • Thread