Ok, now I'm totally confused. Nothing works at all. I've gone back to the beginning and started again.
I have SWFUpload out of the box, latest version.
Here's my form constructor:
function __construct($controller, $name, $id = 0)
{
$fields = singleton('Message')->getFrontEndFields();
$fields->push(new HiddenField('ProjectId', 'ProjectId', $id));
$fields->push(new SWFUploadField($this, 'MessageFile', 'Upload Message Files'));
$validators = new RequiredFields('Body');
$actions = new FieldSet(new FormAction('submit', 'Save Message'));
parent::__construct($controller, $name, $fields, $actions, $validators);
}
This is not even saving a file. No file in the Uploads directory, no record in the database in the Files or MessageFiles tables.
I've created a class called MessageFile that has nothing in it but
class MessageFile extends File
{
static $has_one = array('Message' => 'Message');
}
So if I understand correctly, this should work, but it should just save a file to uploads and do nothing with it, since I'm not setting the $file_class or handing it in my form's submit() method, right? And if I want to save a message file to the Uploads directory, I should just change $file_class at the beginning of my form's __construct method?
Sorry for all the confusion, I'm utterly vexed . . .