If you create a module through the Builder module, just add 'file' => 1 to the 'templates' array in the $ config (config.php) variable. Then you can add a new file upload field to editviewdefs.php:
1 => array ( 'name' => 'uploadfile', 'displayParams' => array ( 'onchangeSetFileNameTo' => 'document_name', ), ),
Remember to add form and javascript elements to the templateMeta array in editviewdefs.php:
'form' => array ( 'enctype' => 'multipart/form-data', 'hidden' => array ( ), ), 'javascript' => '<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script> <script type="text/javascript" src="include/javascript/sugar_grp_jsolait.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script> <script type="text/javascript" src="modules/Documents/documents.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>',
You also need to add the uploadfile field to the detailvidefs.php file:
1 => array ( 'name' => 'uploadfile', 'displayParams' => array ( 'link' => 'uploadfile', 'id' => 'id', ), ),
Hope this helps!
source share