multiple file upload field in custom module

I’ve created a file upload filed by using the method below:
https://community.sugarcrm.com/thread/22204

It works perfectly when there is only one file upload field However, when I add another file upload field by adding änother “$dictionary[‘Case’][‘fields’][‘filename’] = array(” block and changed the “name” of the field, it adds another filed. but when I upload 2 files together or just 1 by 1, it fails to generate the correct url to the uploaded file.

for example:
The name of the file upload fields are “good”, “bad”.
and the url to the uploaded files should look like:
https://yourdomoin/index.php?entryPoint=download&id=<RECORD_ID>good&type=
https://yourdomoin/index.php?entryPoint=download&id=<RECORD_ID>
bad&type=

But now, I have a same link for both uploaded file, the url looks like:
https://yourdomoin/index.php?entryPoint=download&id=<RECORD_ID>&type=

As result, I can only have access of one of the 2 files which is the latest uploaded one.

Are there any ways to solve this problem?

Thanks!

Just create a relationship from your custom module into the Notes module, and upload documents as Notes.