FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Pls help with output of csv file to browser?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Pls help with output of csv file to browser? [message #179286 is a reply to message #179280] Mon, 01 October 2012 18:50 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: FEDEX Shipping
Next Topic: Asynchronous execution of PHP file
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 20:03:16 GMT 2024

Total time taken to generate the page: 0.06866 seconds