Need custom file upload field with delete functionality

Hi All,

I need a custom file upload field on Cases module. For this purpose I followed completely this blog (www.bhea.com/blog/creating-file-upload-field-core-modulecustom-module-sugar-7-x/).

I'm able to upload file but deletion of file is not working.

Any help will be highly appreciable.

Regards

Parents Reply Children
  • Hi hats

    I'm working with sugar 8.3 and trying to create custom upload field in opportunity.  

    Requirement:

    1) I can upload file from create and edit.

    2) I can see the file in record view as a link.

    3) After clicking on link, the file must download.

     I follow www.bhea.com/blog/creating-file-upload-field-core-modulecustom-module-sugar-7-x/ this example. 

    Now problem is I can upload file but file is not showing in record view. 

    /*

    * This is code in vardef file.

    */

    <?php

    $GLOBALS['dictionary']['Opportunity']['fields']['filename'] = array (

    'name' => 'filename',
    'vname' => 'LBL_FILENAME',
    'type' => 'file',
    'dbType' => 'varchar',
    'len' => '255',
    'reportable' => true,
    'comment' => 'File name associated with the note (attachment)',
    'importable' => false,
    'source' => 'non-db',
    'docUrl' => 'doc_url',
    );

    $GLOBALS['dictionary']['Opportunity']['fields']['file_mime_type'] = array(

    'name' => 'file_mime_type',
    'vname' => 'LBL_FILE_MIME_TYPE',
    'type' => 'varchar',
    'len' => '100',
    'comment' => 'Attachment MIME type',
    'importable' => false,
    'source' => 'non-db',
    );

    $GLOBALS['dictionary']['Opportunity']['fields']['file_url'] = array (
    'name'=>'file_url',
    'vname' => 'LBL_FILE_URL',
    'type'=>'varchar',
    'source'=>'non-db',
    'reportable'=>false,
    'comment' => 'Path to file (can be URL)',
    'importable' => false,

    );

    /*

    * This is code in editviewdefs.php file.

    */

    $viewdefs['Opportunity']['EditView'] = array(
    'templateMeta' => array('form' => array('enctype'=> 'multipart/form-data',),));

     

    Help highly appreciated.