Chuck,

 If you don't send the Content-length, the browser will have no idea how
much data it should expect during download. If you want the transfer size to
be shown during download then you need to provide the total Content-length
of the HTTP message body. Remember: this includes ALL characters in the body
after the first CRLF that starts the body section of the
response(CR,LF,FF,etc).

DATA<1>="1,2,3,4"
DATA<2>="5,6,7,8"

 If DATA<1> and DATA<2> are sent to the browser with UV adding CRLF combos
for each attribute of DATA then the total Content-length would be 18. 14 for
the visible chars and 4 for both CRLF combos. If you notice your download
coming up short on a few characters, then check your content length
calculator.

 As far as forcing a download, just set the MIME-type to a bogus application
value. Content-type: application/keyally. The browser will prompt the user
to determine how to handle the "keyally" document type. To take this a step
further, you could write your own CSV import utility for the O/S and update
the O/S file handling to match. Set file types of .keyally and also MIME
types of application/keyally to open with <insert import tool>.

----------------------------------------
Glen Batchelor
IT Director
All-Spec Industries
 phone: (910) 332-0424
   fax: (910) 763-5664
E-mail: [EMAIL PROTECTED]
   Web: http://www.all-spec.com
  Blog: http://blog.all-spec.com
----------------------------------------

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of Rex Gozar
> Sent: Thursday, November 08, 2007 5:43 PM
> To: [email protected]
> Subject: Re: [U2] Pushing csv
> 
> Charles,
> 
> To have the browser treat your data stream as a download, you need to
> set the HTTP header "Content-type: application/download".  This needs to
> be set in the "header", not the <HEAD> section.
> 
> Universe has the setRequestHeader() function, but the documentation is
> not clear on how to set the body of the data.
> 
> Normally, an HTTP response is pretty straightforward:
> 
> 001: Content-type: application/download
> 002:
> 003: some,comma,delimited,data
> 004: some,comma,delimited,data
> 
> Omit the line numbers.  The HTTP header is separated from the content
> using a blank line (linefeed).  I don't think any other headers are
> required (but I could be wrong.) "Content-length" is nice to have.
> 
> Note that you can experiment with other mime-types to get the download
> to open in an application.
> 
> rex
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to