Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7216

Re: Pls help with output of csv file to browser?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Pls help with output of csv file to browser?
Date 2012-10-01 14:50 -0400
Organization A noiseless patient Spider
Message-ID <k4colp$n93$1@dont-email.me> (permalink)
References <h7og68tjuulikujgrv1k7usbtue38a4s69@4ax.com>

Show all headers | View raw


On 9/30/2012 11:19 AM, BobMCT wrote:
> I'm trying to add the generation of a csv file to send to the
> requestor's browser.  So far I do have it working (sort of) by sending
> special headers indicating a text file and using fputcsv.  The user
> receives the expected what to do prompt and if saved the dialog box
> asking where to save it appears and works.
>
> That's the good part.
>
> The bad part is that there is no resulting/completion page.  And, if I
> examine the saved csv file it actually contains the html for the
> subsequent page and the originating page still resides on the
> requestor's screen.
>
> My guess would be that once the file is sent another set of header
> details must be sent to tell the browser that html is now coming.
> But, I cannot locate any examples of what to send in this case.
>
> I'm hoping that some of you readers have done this before and can
> share the technique/mechanism used to accomplish this successfully.
>
> Any ideas/examples/suggestions greatly appreciated.
>
> Thank
>

Not possible the way you're trying to do it.  A request to the server 
can return exactly one content-type.  It can be an image, a web page 
(i.e. html), a document (i.e. .csv) or whatever.  You are trying to 
return two different types (a .csv followed by a .html) in the same 
request.  It's not allowed.

You also can't send javascript or an html redirect in a .csv file - the 
browser will just consider that part of the .csv file.  And you can't 
send an http redirect followed by the .csv file.

IOW, your design won't work.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Pls help with output of csv file to browser? BobMCT <r.mariotti@fdcx.net> - 2012-09-30 11:19 -0400
  Re: Pls help with output of csv file to browser? "Peter H. Coffin" <hellsop@ninehells.com> - 2012-09-30 10:41 -0500
  Re: Pls help with output of csv file to browser? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 19:01 +0200
  Re: Pls help with output of csv file to browser? bill <william@TechServSys.com> - 2012-10-01 08:16 -0400
    Re: Pls help with output of csv file to browser? The Natural Philosopher <tnp@invalid.invalid> - 2012-10-01 23:28 +0100
  Re: Pls help with output of csv file to browser? Jerry Stuckle <jstucklex@attglobal.net> - 2012-10-01 14:50 -0400
  Re: Pls help with output of csv file to browser? Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-02 03:41 +0000

csiph-web