note 17663 deleted from function.base64-decode by jimw

From: Date: Fri, 21 Dec 2001 00:46:19 +0000
Subject: note 17663 deleted from function.base64-decode by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23690@lists.php.net to get a copy of this message
Using base64 encoding is a useful way to store binary data in a database. Say, for example, you want to store images, Word docs, or some other binary file in your database, instead of storing the path to the item and then linking to it. Simply base64_encode() the file and INSERT the text string in a text or memo field in your DB. On the way out of the DB, you have to make sure the file is streamed with the appropriate header so the browser handles it correctly. With an image, for example, you would use something like: header("Content-Type: image/jpeg"); And then you have to base64_decode() the text string you got from the DB, and stream it to the browser.

« previous php.notes (#23690) next »