base64.php

Go to the documentation of this file.
00001 <html>
00002         <head>
00003                 <title>
00004                         Generate the base64 from one of the icons
00005                 </title>
00006         </head>
00007         <body>
00008 <?php
00009 $strFile = @$_REQUEST[ 'file_selected' ];
00010 print $strFile;
00011 if( $strFile )
00012 { 
00013         $strText = base64_encode( file_get_contents( $strFile ) );
00014 
00015         $j = 0;
00016         print "<pre>'";
00017         for( $i = 0; $i < strlen( $strText ) ; $i++ )
00018         {
00019                 $j++;
00020                 if( $j > 0 && $j % 50 == 0)
00021                 {
00022                         print "'+\n'";
00023                 }
00024                 print $strText[$i];     
00025         }
00026 }
00027 else
00028 {
00029         $arrDirFiles = scandir( __DIR__ );
00030         array_shift( $arrDirFiles ); // remove .
00031         array_shift( $arrDirFiles ); // remove ..
00032         ?>
00033                 <form action="" method="post">
00034                         <select name="file_selected">
00035                                 <?php foreach( $arrDirFiles as $strFile ): ?>
00036                                         <option><?php print $strFile ?></option>
00037                                 <?php endforeach ?>
00038                         </select>
00039                         <input type="submit"/>
00040                 </form>
00041         <?php
00042 }
00043 ?>
00044         </body>
00045 </html>

Generated on Sat Apr 7 14:19:11 2012 for CodeToDiagram by  doxygen 1.5.9