static public function decodeFile($binary) {
        
        $returnValue = array('name' => '', 'mime' => '', 'data' => '');
        
        if (empty($binary) === false) {
            
            $filenameLen = current(unpack('S', substr($binary, 0, 2)));
            if ($filenameLen > 0) {
                $returnValue['name'] = substr($binary, 2, $filenameLen);
            }
            
            $mimetypeLen = current(unpack('S', substr($binary, 2 + $filenameLen, 2)));
            $returnValue['mime'] = substr($binary, 4 + $filenameLen, $mimetypeLen);
            
            $returnValue['data'] = substr($binary, 4 + $filenameLen + $mimetypeLen);
        }
        
        return $returnValue;
    }
static public function decodeFile($binary) {
        
        $returnValue = array('name' => '', 'mime' => '', 'data' => '');
        
        if (empty($binary) === false) {
            
            $filenameLen = current(unpack('S', substr($binary, 0, 2)));
            if ($filenameLen > 0) {
                $returnValue['name'] = substr($binary, 2, $filenameLen);
            }
            
            $mimetypeLen = current(unpack('S', substr($binary, 2 + $filenameLen, 2)));
            $returnValue['mime'] = substr($binary, 4 + $filenameLen, $mimetypeLen);
            
            $returnValue['data'] = substr($binary, 4 + $filenameLen + $mimetypeLen);
        }
        
        return $returnValue;
    }
static public function decodeFile ( $ binary ) { $ returnValue = array ( 'name' => '' , 'mime' => '' , 'data' => '' ) ; if ( empty ( $ binary ) === false ) { $ filenameLen = current ( unpack ( 'S' , substr ( $ binary , 0 , 2 ) ) ) ; if ( $ filenameLen > 0 ) { $ returnValue [ 'name' ] = substr ( $ binary , 2 , $ filenameLen ) ; } $ mimetypeLen = current ( unpack ( 'S' , substr ( $ binary , 2 + $ filenameLen , 2 ) ) ) ; $ returnValue [ 'mime' ] = substr ( $ binary , 4 + $ filenameLen , $ mimetypeLen ) ; $ returnValue [ 'data' ] = substr ( $ binary , 4 + $ filenameLen + $ mimetypeLen ) ; } return $ returnValue ; }
Decode a binary string representing a file into an array.

The binary string that is decoded must respect the following scheme:

* filename length, unsigned short
* filename, string
* mimetype length, unsigned short
* mimetype, string
* binary content of the file, string

The returned array contains tree cells with the following keys:

* name, string (might be empty)
* mime, string
* data, string

@param string $binary A binary string representing the file to be decoded.
@return array The decoded file as an array.
Decode a binary string representing a file into an array .