Re: Dynamic generation of text files?
| From: | Dan Costello | Date: | Tue, 20 Mar 2001 10:42:09 +0000 |
| Subject: | Re: Dynamic generation of text files? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44714@lists.php.net to get a copy of this message | ||
Michael-
Thank you, it works perfectly!
--Dan
"Michael Kimsal" <michael@tapinternet.com> wrote in message
news:3AB61E8E.F3D43B1@tapinternet.com...
> <a href="/scripts/GenericCard.php?uid=UniqueUserKey">Click here for John
> Doe's vCard</a>
>
> GenericCard.php would have something like...
>
> //
> // build $text from $uid passed in
> //
> header("Content-type: x/y");
> header("Content-Disposition: attachment; filename=$filename" );
> print $text;
> exit();
>
> "x/y" would be something like text/html or application/vnd.excel or
> something like that. Whatever the defined MIME header for
> Vcards is, put that after the content-type. $filename
> would be the name of the file you want to call this - something.vcf
> I'd expect.
>
> We do this with Excel files all the time - sending down tab-delimited
text,
> and putting an excel application header on the file.
>
> Dan Costello wrote:
>
> > Hi,
> >
> > I'm trying to get my site to generate text files with a certain
extension
> > and MIME-type from a database, "on the fly".
> >
> > Specifically, I would like to build something that can create vCards,
that
> > is, text files of a particular format with the extension *.vcf,
mime-type
> > text/x-vcard, _at the time that the user clicks the link to download the
> > file_.
> >
> > Currently, the only way I have of doing this is prebuilding all the vcf
> > files when the page is built, then deleting them when the user goes
> > somewhere else -- pretty inefficient. I'd really like to have, e.g. a
bunch
> > of links that look like this:
> >
> > <a href="/scripts/GenericCard.vcf?uid=UniqueUserKey">Click here for John
> > Doe's vCard</a>
> >
> > ...so that when the user clicks the link, their contact manager
(Outlook, or
> > whatever) fires up on their machine and displays the freshly-generated
> > vCard.
> >
> > I have, of course, thought of modifying the httpd.conf to have apache
parse
> > files with a .vcf extension through the php interpreter -- I think that
this
> > would be a very bad idea. ;-)
> >
> > So, is this too much to hope for?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>