Hi All,
I am trying to upload multiple files in the Calls module and have a some questions/issues:
I used the following forum post and the Notes module as a jumping off point:
- When adding a new code to: `custom/modules/Calls/metadata/editviewdefs.php, the changes do not seem to work. I copied the editviewdefs file from the original Calls module and added the enctype
Once I add in an image field from the Studio then the enctype finally is added to the form.
$viewdefs['Calls'] =
array(
'EditView' =>
array(
'templateMeta' =>
array(
'includes' => array(
array('file' => 'modules/Reminders/Reminders.js'),
),
'maxColumns' => '2',
'form' =>
array(
'enctype' => 'multipart/form-data',
'hidden' =>
array(
0 => '<input type="hidden" name="isSaveAndNew" value="false">',
1 => '<input type="hidden" name="send_invites">',
2 => '<input type="hidden" name="user_invitees">',
3 => '<input type="hidden" name="lead_invitees">',
4 => '<input type="hidden" name="contact_invitees">',
),
'buttons' =>
The above is a snippet
- I added the extra file attachment fields, incrementing the names
<?php
$dictionary['Calls']['fields']['filename']=array(
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'varchar',
'required'=>true,
'importable' => 'required',
'len' => '255',
'studio' => 'false',
);
$dictionary['Calls']['fields']['file_ext']=array(
'name' => 'file_ext',
'vname' => 'LBL_FILE_EXTENSION',
'type' => 'varchar',
'len' => 100,
);
$dictionary['Calls']['fields']['file_mime_type']=array(
'name' => 'file_mime_type',
'vname' => 'LBL_MIME',
'type' => 'varchar',
'len' => '100',
);
$dictionary['Calls']['fields']['uploadfile']=array(
'name'=>'uploadfile',
'vname' => 'LBL_FILE_UPLOAD',
'type' => 'file',
'len' => '255',
'dbType' => 'varchar',
);
$dictionary['Calls']['fields']['filename_2'] = array(
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'varchar',
'required' => true,
'importable' => 'required',
'len' => '255',
'studio' => 'false',
);
$dictionary['Calls']['fields']['file_ext_2'] = array(
'name' => 'file_ext',
'vname' => 'LBL_FILE_EXTENSION',
'type' => 'varchar',
'len' => 100,
);
$dictionary['Calls']['fields']['file_mime_type_2'] = array(
'name' => 'file_mime_type',
'vname' => 'LBL_MIME',
'type' => 'varchar',
'len' => '100',
);
$dictionary['Calls']['fields']['uploadfile_2'] = array(
'name' => 'uploadfile',
'vname' => 'LBL_FILE_UPLOAD',
'type' => 'file',
'len' => '255',
'dbType' => 'varchar',
);
$dictionary['Calls']['fields']['filename_3'] = array(
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'varchar',
'required' => true,
'importable' => 'required',
'len' => '255',
'studio' => 'false',
);
$dictionary['Calls']['fields']['file_ext_3'] = array(
'name' => 'file_ext',
'vname' => 'LBL_FILE_EXTENSION',
'type' => 'varchar',
'len' => 100,
);
$dictionary['Calls']['fields']['file_mime_type_3'] = array(
'name' => 'file_mime_type',
'vname' => 'LBL_MIME',
'type' => 'varchar',
'len' => '100',
);
$dictionary['Calls']['fields']['uploadfile_3'] = array(
'name' => 'uploadfile_3',
'vname' => 'LBL_FILE_UPLOAD',
'type' => 'file',
'len' => '255',
'dbType' => 'varchar',
);
This all works good and the database has the filenames and seems to work.
But the files when I download them all are the same and there is only one file with in the upload directory.
Is there a way to make sure that my editviewdef.php is used and is there a way to make the three files that are being uploaded are actually saved?
SuiteCRM-8.2.3
XAMPP on Windows
PHP Version 7.4.33
Thanks!
P