concept file upload in category grails

appears as: file uploads
Grails in Action, Second Edition

This is an excerpt from Manning's book Grails in Action, Second Edition.

In this section, we’ll explore how to handle file uploads (your user’s profile photo) and how to render custom content types (image data, in your case). Although your next application might not have much use for photos, the techniques are useful for whatever kind of content you want to render.

You have two ways to handle file uploads in a controller, and the one you select depends on what you want to accomplish. If you want to store the image in a domain class, your best option is to use a command object. The following listing shows how to use a command object for photo uploads. We look at storing images on the filesystem in the next subsection.