Upload multiple files within custom block

Permalink
Hi

I have created custom blocks for our website but I am looking at creating a block that has (upto) 6 files appended to it.

I have set up the db.xml to manage 6 separate files, but I cannot get the code correct to add them. Currently if I add a more than one file it overwrites the previous file (i.e. only one file).

I have searched the forums to no avail so any support would be greatly appreciated.

add.php
<?php 
        $includeAssetLibrary = true;
        $al1 = Loader::helper('concrete/asset_library');
        $al2 = Loader::helper('concrete/asset_library');
        $al3 = Loader::helper('concrete/asset_library');
        $al4 = Loader::helper('concrete/asset_library');
        $al5 = Loader::helper('concrete/asset_library');
        $al6 = Loader::helper('concrete/asset_library');
        ?>
        <h2><?php echo t('Files to upload')?></h2>
        <!-- Consent Forms -->
        <p>Consent Form</p>
        <?php echo $al1->file('ccm-b-file', 'fID1', t('Choose File'), $bf);?>
        <!-- Risk Assessment -->
        <p>Risk Assessment</p>

db.xml
<field name="fID1" type="I"></field>
                <field name="fID2" type="I"></field>
                <field name="fID3" type="I"></field>
                <field name="fID4" type="I"></field>
                <field name="fID5" type="I"></field>
                <field name="fID6" type="I"></field>

 
ramonleenders replied on at Permalink Best Answer Reply
ramonleenders
You have 'ccm-b-file' everywhere, try appending numbers here as well!

If that does not work (yet), add the 'fID1', 'fID2' etc to the $btExportFileColumns array in your controller.php file.

I also see you always pass $bf as an instance to the function. This should be all different instances of each file. So you probably have the same image everywhere I assume?
nhunt replied on at Permalink Reply
Thanks - that has resolved the issue of single loading for me by amending the $bf and ccm-b-id.

Thanks for your response
ramonleenders replied on at Permalink Reply
ramonleenders
Great it worked! If you want to help other users as well, you can mark the reply as best answer.