+', "_", "all" )>
var chunk = "";
var fileReaderClass = "";
var fileReader = "";
var file = "";
var done = false;
var counter = 0;
var byteArray = "";
if( not fileExists( ARGUMENTS.fileName ) )
{
return "" ;
}
if (REQUEST.CFVersion gte 8)
{
file = FileOpen( ARGUMENTS.fileName, "readbinary" ) ;
byteArray = FileRead( file, 1024 ) ;
chunk = toString( toBinary( toBase64( byteArray ) ) ) ;
FileClose( file ) ;
}
else
{
fileReaderClass = createObject("java", "java.io.FileInputStream");
fileReader = fileReaderClass.init(fileName);
while(not done)
{
char = fileReader.read();
counter = counter + 1;
if ( char eq -1 or counter eq ARGUMENTS.bytes)
{
done = true;
}
else
{
chunk = chunk & chr(char) ;
}
}
}
+', "_", "all" )>