<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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to