473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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?
Jul 16 '05 #1
1 3988
sam
<?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 <no****@hursley.ibm.com> wrote in message news:<3f***********************@freenews.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?

Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
7
by: Martin | last post by:
I have a situation where I'm displaying some information in a table on a web page. I've given the user the ability to make several different "queries" and show different sub-sets of the data. I...
1
by: Amy L. | last post by:
I am working on creating a web service that will create a signed xml file. I would like to create this file in memory and than somehow email it to the user that requested it to be generated. I...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
3
by: Bob | last post by:
I need to create a program that is essentially a special fax sender using multi line Dialogic cards. I figure that the best way to do this so that it can be used from any app is to create someting...
7
by: Wiebe Tijsma | last post by:
Hi, I'm using C# + webDAV to create a draft message to be sent in a user's Drafts folder. I can create the message successfully, however when I open the message in outlook, it doesn't show...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
3
by: sanghavi | last post by:
how to create a set up project in vb.net..how to run an application on a different machine
6
by: Mr. X. | last post by:
Hello. How can I create aspnetdb from scratch ? (I want a script that create all table, views, etc... on that database). Thanks :)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.