Writing to a Local File

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
We have a PHP/MySQL database application.  A user would like to be able
to run a routine to read selected data from the database and export a
flat file to their local C: drive.  After reviewing the documentation
and posts, it is not clear how to do this, or even if it is allowed by
the browser.  If someone could point us in the right direction, we
would greatly appreciate it.

The application is hosted on a Linux server.
The users are required to use Internet Explorer running on Windows 2000
or XP (we also use VBScript).


Re: Writing to a Local File

On 21 Nov 2006 10:56:54 -0800, himilecyclist@yahoo.com wrote:

Quoted text here. Click to load it

 You can't write to specific locations on the user's computer directly; this
would be a security nightmare. You can offer a file that the user can download
and save to the location of their choosing, however.

 For example, you could use PHP to print out information in CSV (comma
separated variables) format. The user can use "Save As" or the equivalent for
their browser to save it to a file. You can use the Content-type and
Content-disposition headers to mark the type of the output, which may influence
how the browser processes it (e.g. open in Excel, save to a file, etc.)

Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Site Timeline