multiple file upload field in custom module

I’ve created a file upload filed by using the method below:

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:

But now, I have a same link for both uploaded file, the url looks like:

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?


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