1

I'm running into a problem using Channel Forms on EE 3.4.4 with a file field inside a grid. If the filename contains a comma it will initially submit but subsequent saves return an error message: 'There was a problem with one or more grid fields'.

Everything works as intended through the Control Panel, it only appears to be affecting Channel Forms. As soon a I remove the file with the comma in the name it works perfectly fine.

Has anyone had any similar problems with this at all?

0

Caution: I've noticed that duplicate files are being added when submitting an entry. I'm not sure whether this is a result of the below or not. First test indicate not but I'd use the below with caution.

I have managed to fixed this problem but its not entirely elegant.

Wherever the file name is being referenced in the 'file field' view file I've added str_replace to convert %2C to a comma. <?=str_replace('%2C', ',', $string)?>

system/ee/EllisLab/ExpressionEngine/View/_shared/file/field.php

<div class="file_field">
    <div class="file_set <?=$set_class?>">

        <p class="filename">
            <img src="<?=$thumb?>" alt="<?=str_replace('%2C', ',', $alt)?>"/> <!-- Optional -->
            <br />
            <?=str_replace('%2C', ',', $filename)?> <!-- Optional -->
            <?=$remove_file_link?>
        </p>
        <p><?=str_replace('%2C', ',', $hidden);?></p> <!-- Required -->
    </div>

    <div class='file_upload'>
        <p class="sub_filename">
            <?=$undo_link?>
            <?=$filebrowser ? $upload_link : ''?>
        </p>

        <div class="no_file <?=($filebrowser || $filename) ? 'js_hide' : ''?>">
            <p class='sub_filename'><?=$upload?></p>
            <?php if ( ! $allowed_file_dirs):?>
                <p><?=$dropdown?></p>
            <?php else: ?>
                <p><?=$directory?></p>
            <?php endif; ?>

            <?php if ( ! empty($existing_files)) : ?>
                <p class="file_existing"><?=$existing_files?></p>
            <?php endif; ?>
        </div>
    </div>
</div>
<div class="clear"></div>

I'm not marking this answer as accepted as there is probably a better way to solve this, however, I thought I'd add the answer in case someone else has the issue and needs a temporary fix.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.