note 32021 modified in function.base64-encode by vrana

From: Date: Tue, 17 Aug 2004 14:52:45 +0000
Subject: note 32021 modified in function.base64-encode by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79870@lists.php.net to get a copy of this message
If you want attach a binary file into mail, pay attention to use mode with "B" flag into fopen function (This is useful only on systems which differentiate between binary and text files, i.e. Windows) Include the 'b' flag in order to make your scripts more portable. <?php $handle = fopen($source_file,'rb'); $file_content = fread($handle,filesize($source_file)); fclose($handle); $encoded = chunk_split(base64_encode($file_content)); ?> --was-- If you want attach a binary file into mail, pay attention to use mode with "B" flag into fopen function (This is useful only on systems which differentiate between binary and text files, i.e. Windows) Include the 'b' flag in order to make your scripts more portable. $handle = fopen($source_file,'rb'); $file_content = fread($handle,filesize($source_file)); fclose($handle); $encoded = chunk_split(base64_encode($file_content)); http://php.net/manual/en/function.base64-encode.php

« previous php.notes (#79870) next »