Re: file creation question
| From: | MikeTsapenko | Date: | Thu, 29 Aug 2002 20:58:54 +0000 |
| Subject: | Re: file creation question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114548@lists.php.net to get a copy of this message | ||
Hello, John.
Just use such code:
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$item[file_name]\"");
header("Content-length: ".strlen($item[file_content]));
echo $item[file_content]
This should work...
--
============
Mike Tsapenko
Chief of Web-development Dept.
AlarIT
http://www.AlarIT.com
"John Hegele" <john@joeystillwagon.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:20020829165751.23496.qmail@pb1.pair.com...
> I'm currently building a site for a band and one of the features I'd like
to
> offer is vCalendar files that the user can download. I'd like to be able
to
> pull values from a database to use in the file, but, rather than having
the
> actual file on the server, I was hoping that I could create the file
> dynamically when the user clicks on a link. I think this is possible from
> some information I've come across.
>
> My question here is not regarding anything having to do with the database,
> I'm very familiar with how to pull data from a database with PHP. I just
> can't figure out how I can generate a file, fill it with values from the
> database and allow the user to download it without the file ever really
> existing on the server.
>
> Thanks in advance for any help you can give.
>
> John
>
>