Hello all,
I want to create a widget. The widget has the possibility to upload an image in the backend area. In the frontend the widget just outputs the image. Basically the widget works fine. But somehow the File Upload never works. The widgets appear in the database, but they always get FileId 0. If I set the FileId in the database to a proper/existing value the outputted site looks perfect.
Thats my code:
<?php
class StandardTeaser extends Widget {
static $title = "Neuer Standard-Teaser";
static $cmsTitle = "Neuer Standard-Teaser";
static $description = "Neuen Standard-Teaser anlegen";
static $db = array(
'Header' => 'Text'
);
static $has_one = array(
'File' => 'File'
);
function getCMSFields() {
$fields = new FieldSet();
$fields->push( new TextField('Header'));
$fields->push( new FileField('File'));
return $fields;
}
}
?>
if I use ImageField instead of FileField then the backend does not even appear.
Is there something special with file uploads in widgets?
thanks so much,
florian