I'd like to use GridField for adding an ImageGallery (similar to UncleCheese's ImageGallery Module but a lot easier). The only problem I have is, that I can only add images to the DataObjects (ImageResource) I use if I save every record once and add the image after that. But that's really dumb when adding more than 1 image at a time.
Here's the code I'm using:
You could always use an UploadField and enable multiple attachments. It does currently have a couple of downsides at the moment;
1. causing the CMS to load slower (see my post here; http://www.silverstripe.org/general-questions/show/20677)
2. no easy way of manually sorting, but you can sort by title or other field if the order they're uploaded isn't suitable
$uf = new UploadField('Name');
// if you need to limit the extensions of files uploaded
$uf->allowedExtensions = array('jpg', 'gif', 'png');
@wmk: Thank you, that work's like a charme.
@Christopher: I think you misunderstood the question. The field wasn't the problem. But since I only want 1 Image on 1 ImageResource I think it wouldn't be the right solution to add a multiple UploadField to it (since there is no $has_many relation). The solution of wmk with bulk-uploading is exactly the thing I wanted to do.