php - readfile('filename.exe') and decode base64? -


i'm using in order stream file download. part of uses readfile:

<?php     // headers etc...     // ...     readfile('file.exe'); ?> 

this binary file, various reasons (that not relevant question) need store file base64 or similar.

how stream file readfile stored encoded base64?

i guess there many ways lead success here, i'm looking best & convenient.

using stream filters should help:

$infile = 'file.exe'; $outfile = 'php://output';  $inhandle = fopen($infile, 'r'); $outhandle = fopen($outfile, 'w');  stream_filter_append($inhandle, 'convert.base64-decode');  stream_copy_to_stream($inhandle , $outhandle); fclose($inhandle ); fclose($outhandle); 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -