I have created a File upload field using this tutorial:
http://www.bhea.com/blog/creating-file-upload-field-core-modulecustom-module-sugar-7-x/
I have reproduced steps 1,2, and 3 in the tutorial.
Now I have a functional File Upload button in Editview.

When I go to Editview and i remove the file, the file is unlinked from the entity. But an empty record is displayed in Listview.
It is a bug because the database gets filled with empty records.

Empty lines should not appear in Listview. The uploaded File should be simply removed and deleted from the database.
Each time I delete a file uploaded in the File field, an empty record appears.
SuiteCRM 7.8.1
I found the solution, I want to share it with you:
I also proceeded to the next steps in the tutorial to remove the uploaded file.
http://www.bhea.com/blog/creating-file-upload-field-core-modulecustom-module-sugar-7-x/
At step 2, instead of the code for the deleteAttachment method provided by the tutorial, i added the following code:
public function deleteAttachment($isDuplicate = 'false')
{
if ($this->ACLAccess('edit')) {
if ($isDuplicate === 'true') {
return true;
}
$removeFile = "upload://{$this->id}";
}
if (file_exists($removeFile)) {
if (!unlink($removeFile)) {
$GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]");
} else {
$this->uploadfile = '';
$this->filename = '';
$this->file_mime_type = '';
$this->file_ext = '';
$this->save();
return true;
}
} else {
$this->uploadfile = '';
$this->filename = '';
$this->file_mime_type = '';
$this->file_ext = '';
$this->save();
return true;
}
return false;
}
Now everything works fine!
Most helpful comment
I found the solution, I want to share it with you:
I also proceeded to the next steps in the tutorial to remove the uploaded file.
http://www.bhea.com/blog/creating-file-upload-field-core-modulecustom-module-sugar-7-x/
At step 2, instead of the code for the deleteAttachment method provided by the tutorial, i added the following code:
Now everything works fine!