Create text file and download

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simon Rigby

    #1

    Create text file and download

    Hi folks,

    Excuse if this has been asked before, and by all means just point me at
    a thread if thats a suitable response.

    I have a mySql database which I am running various queries against. Can
    anyone suggest a way of creating a text file which is downloaded to the
    user. In particuar is there a way of doing this without creating the
    file on the server. In other words create it as a temp file as such and
    then download that.

    Hope this makes sense.

    Thanks in advance

  • Sjoerd

    #2
    Re: Create text file and download


    Simon Rigby wrote:[color=blue]
    > Can
    > anyone suggest a way of creating a text file which is downloaded to the
    > user.[/color]

    Output plain text and use header() to set the following headers:
    Content-type: text/plain
    Content-disposition: attachment; filename=myfile .txt

    Comment

    • strawberry

      #3
      Re: Create text file and download

      a text file of what?

      Simon Rigby wrote:[color=blue]
      > Hi folks,
      >
      > Excuse if this has been asked before, and by all means just point me at
      > a thread if thats a suitable response.
      >
      > I have a mySql database which I am running various queries against. Can
      > anyone suggest a way of creating a text file which is downloaded to the
      > user. In particuar is there a way of doing this without creating the
      > file on the server. In other words create it as a temp file as such and
      > then download that.
      >
      > Hope this makes sense.
      >
      > Thanks in advance[/color]

      Comment

      • Simon Rigby

        #4
        Re: Create text file and download

        Many Thanks

        Sjoerd wrote:[color=blue]
        > Simon Rigby wrote:[color=green]
        > > Can
        > > anyone suggest a way of creating a text file which is downloaded to the
        > > user.[/color]
        >
        > Output plain text and use header() to set the following headers:
        > Content-type: text/plain
        > Content-disposition: attachment; filename=myfile .txt[/color]

        Comment

        Working...