Save a File type field of a base64 image through API

Hi All, I wonder if there's a way to upload/save the file type field of an image which I encoded to base64. I have created a file type field where on the portal module it worked fine when I uploaded and downloaded the file. But I don't know how to configure this through API with sugarbean.

This is my vardef example.

<?php

$dictionary['mymodule']['fields']['myfield']['name'] = 'myfield';
$dictionary['mymodule']['fields']['myfield']['vname'] = 'LBL_MYFIELD';
$dictionary['mymodule']['fields']['myfield']['type'] = 'file';
$dictionary['mymodule']['fields']['myfield']['dbType'] = 'varchar';
$dictionary['mymodule']['fields']['myfield']['len'] = 255;
$dictionary['mymodule']['fields']['myfield']['comment'] = 'myfield comment';
$dictionary['mymodule']['fields']['myfield']['required'] = false;
$dictionary['mymodule']['fields']['myfield']['audited'] = false;
$dictionary['mymodule']['fields']['myfield']['custom_file_field'] = true;

?>

This is the data

{
    "files": {
        "myfield1": {
            "filename": "Example1.jpg",
            "file_contents": "data:image/jpg;base64,base64_encoded_data_here"
        },
        "myfield2": {
            "filename": "Example2.jpg",
            "file_contents": "data:image/jpg;base64,base64_encoded_data_here"
        }
    }
}