Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

downloading variable data

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

downloading variable data

Postby meone » Mon Jun 23, 2003 12:04 pm

This might be a stupid question but i was wondering if it was possible with php to take the data from a variable and have a user download it as a file. I know that i could make a file and write the data to it. Then have them download that file and then erase the file when it is done. But i was wondering if there is a way to skip those steps? thanks for your help
meone
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jun 23, 2003 11:30 am

Postby Redcircle » Tue Jun 24, 2003 11:54 pm

it is very possible to do that.

Before you echo anything out to the browser you will have to send a header call with the file type.

lookup http://www.php.net/header
Code: Select all
header("Cache-control: private");
header("Content-type: application/zip");
header("Content-disposition:attachment; filename=$filename");
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby meone » Wed Jun 25, 2003 11:04 am

thanks for the help
meone
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jun 23, 2003 11:30 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.