We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Error, Field-Types

File fieldtype in a repeater

I'm running Perch 2.8.18 and I've set up a repeater, like so:

<perch:repeater id="performance_music" label="Music" divider-before="Performance Music" order="3">
        <perch:if exists="performance_music_file">
        <hr>
        <perch:content id="performance_music_title" type="text" size="xl" textile="false" label="Song Title" required="true" /><perch:if exists="performance_music_artist"> – <perch:content id="performance_music_artist" type="text" size="xl" textile="false" label="Artist" /></perch:if><br>
        <audio controls preload="none" autobuffer>
        <source src="<perch:content id="performance_music_file" type="file" bucket="performance-music" label="MP3 File" output="path" />" type="audio/mpeg" />
        Your browser does not support the <code>audio</code> element.</audio>
        </perch:if>
</perch:repeater>

The problem is when I select a file, it doesn't show that a file has been selected (although it has sometimes but after clicking save, it disappears again from the selection). I've tried it with MP3 and PDF files.

Any idea what's going on? Can the file fieldtype not be used in a repeater?

Philip Gwynne

Philip Gwynne 1 points

  • 4 years ago

Update: It does work if you upload via assets first (not the asset panel), then go back to the field and select it from the assets panel. So the issue seems to be the assets panel?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Your bucket name is over the 16 character maximum.

Good spot! Thanks