Blog Sections Open

Uploading Multiple Images with FormLister During Resource Creation

A practical FormLister pattern for handling more than one uploaded image while a form creates or updates a resource.

FormLister becomes much more useful when it handles not just text fields but actual media uploads. This donor focused on a common next step: allowing several images to be uploaded while a form creates a page or stores submission data.

The core pattern is to use array-style file inputs and process the uploaded files inside a custom prepareProcess handler.

<input type="file" name="userpic[]">
<input type="file" name="userpic[]">

On the server side, the custom processor can normalize file names, create a destination folder, validate extensions, and move each uploaded file to its final path.

$files = $FormLister->getFormData('files');
$dir = 'test/uploads/';
$filename = $FormLister->fs->getInexistantFilename($dir . $filename, true);

What matters most

  • Handle each uploaded file as a separate array item.
  • Normalize names before saving them.
  • Validate both extension and size before moving files.
  • Keep the final storage path predictable for later output.

This is a good legacy post to keep because it turns a vague “can FormLister upload several files?” question into a reusable implementation pattern.

Newer post

Counting Published Child Documents with DocLister in Evolution CMS

How to think about counting published child resources when rendering a section through DocLister.

Older post

Choosing a Multilingual Strategy for an Evolution CMS 2.0 Project

A practical extras-oriented note about evaluating multilingual options for Evolution CMS 2.0 projects instead of assuming older solutions still fit unchanged.