Professional Web Applications Themes

Create a file and send to user - PHP Development

I need to create a data file from my PHP for the user to load into their word processor as a mail merge data source. Organising the data into rows of comma separated values isn't too difficult; what puzzles me is how to get that data into a .txt file somewhere on the user's PC. How, in general terms, should I go about doing that? Presumably I generate and present it in some format which causes the browser to issue a "save as" dialog box?...

  1. #1

    Default Create a file and send to user

    I need to create a data file from my PHP for the user to load into their
    word processor as a mail merge data source. Organising the data into rows
    of comma separated values isn't too difficult; what puzzles me is how to
    get that data into a .txt file somewhere on the user's PC.

    How, in general terms, should I go about doing that? Presumably I generate
    and present it in some format which causes the browser to issue a "save as"
    dialog box?
    Derek Fountain Guest

  2. #2

    Default Re: Create a file and send to user

    <?php

    // The name of the file on the user's pc
    $file_name = "toto.txt";

    header("Content-Type: application/octet-stream");
    header("Content-Disposition: Attachment; filename=$file_name");

    // $my_data is the string that holds your data
    echo $my_data;

    ?>


    Derek Fountain <nomailhursley.ibm.com> wrote in message news:<3f04eea4$0$23114$5a62ac22freenews.iinet.net .au>...
    > I need to create a data file from my PHP for the user to load into their
    > word processor as a mail merge data source. Organising the data into rows
    > of comma separated values isn't too difficult; what puzzles me is how to
    > get that data into a .txt file somewhere on the user's PC.
    >
    > How, in general terms, should I go about doing that? Presumably I generate
    > and present it in some format which causes the browser to issue a "save as"
    > dialog box?
    sam Guest

Similar Threads

  1. Send for review user list
    By Russ Y in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: April 3rd, 10:51 PM
  2. send user to page-x of resultset?
    By Damnit Spock! in forum Macromedia ColdFusion
    Replies: 1
    Last Post: May 13th, 02:45 AM
  3. Send an email with last URL a user visits?
    By W. D. in forum PHP Development
    Replies: 0
    Last Post: February 24th, 08:38 AM
  4. where should perl create a file for user download?
    By Timothy Driscoll in forum PERL Beginners
    Replies: 1
    Last Post: February 2nd, 01:22 PM
  5. How To Create a Send This Website To a Friend page
    By Garvoir webforumsuser@macromedia.com in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: September 5th, 05:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139