Custom documentation module not upload file in quickcreateview

Hello all!

I have a little trouble with a custom document module.

I created a custom module called INSA_Documentacion which type is a Documentation module, then I created a custom button to make a quick records of this:

popupdefs.php


if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}

$module_name = 'INSA_Documentacion';
$object_name = 'INSA_Documentacion';
$_module_name = 'insa_documentacion';
$popupMeta = array(
    'moduleMain' => $module_name,
    'varName' => $object_name,
    'orderBy' => $_module_name . '.name',
    'whereClauses' => array(
        'name' => $_module_name . '.name',
    ),
    'searchInputs' => array($_module_name . '_number', 'name', 'priority', 'status'),
   'create' => array (
        'formBase' => 'INSA_DocumentacionFormBase.php',
        'formBaseClass' => 'INSA_DocumentacionFormBase',
        'getFormBodyParams' => array(
            0 => '',
            1 => '',
            2 => 'INSA_DocumentacionSave',
          ),
        'createButton' => $mod_strings['LNK_NEW_RECORD'],
    ),
);

Then I created the following FormBase INSA_DocumentacionFormBase.php:


<?php

require_once('include/SugarObjects/forms/FormBase.php');

class INSA_DocumentacionFormBase extends FormBase {

var $moduleName = 'INSA_Documentacion';
var $objectName = 'INSA_Documentacion';

    function handleSave($prefix, $redirect=true, $useRequired=false){
        require_once('include/formbase.php');
        $focus = new INSA_Documentacion();
        $focus = populateFromPost($prefix, $focus);
        $focus->save();
    }
}

The problem is when I try to attach some file and then save the record, the fields of the record are correctly saved but the attached file doesn’t appear neither in the database nor in the upload folder. If I enter in the module and I create a new record “normally” works well.

Can someone help me? I think it is a interesting thing for all of us.

Regards.