7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | ||
| Author | Topic: | 3022 Views |
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 6:31am Last edited: 26 November 2010 6:32am
Thanks to Zauberfisch i managed to disable uploadify:
_config:
DataObjectManager::allow_assets_override(false);Then I went into the normal SS Files & Images
And was able to upload a .doc!I could link the file to my page by choosing (in uploadify on my extended page) -> 'existing file tab' - selected the doc.
Continue/Save button...And then the template showed the doc, with the correct name & path.
Which doesn't happen when i upload it through uploadify.Please help me uncle cheese
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 6:45am Last edited: 26 November 2010 6:46am
Source code
<?php
class publicDownloadPage extends Page {
static $has_many = array (
'Downloads' => 'Download'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this,
'Downloads', // relation name
'Download', // class name of the DataObject
'File', // name of the file relation in the DataObject
array(
'Title' => 'Title',
'Comment' => 'Comment',
), // headings
'getCMSFields_forPopup' // name of the function for the popup fields);
$fields->addFieldToTab('Root.Content.Files', $manager);
return $fields;
}}
class publicDownloadPage_Controller extends Page_Controller {
}
class Download extends DataObject {
static $db = array (
'Title' => 'Text',
'Comment' => 'HTMLText',
);
static $has_one = array (
'File' => 'File',
'publicDownloadPage' => 'publicDownloadPage'
);
public function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Title'));
$fields->push(new SimpleTinyMCEField('Comment'));
$fields->push(new FileUploadField('File','Upload files'));
return $fields;
}
public function onBeforeWrite() {
parent::onBeforeWrite();
if(!$this->Title && $this->FileID) {
$this->Title = $this->File()->Name;
}if(!$this->Comment) {
$this->Comment = "None";
}
}}
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

27 November 2010 at 11:28pm
Still having this problem, can some one help me?
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

5 March 2011 at 3:51am
Hi borriej,
Try to edit file /sapphire/email/mime.types.
Search for msword and add new office extensions.
by ex change line:application/msword doc dot
with
application/msword doc dot docx dotx
| 3022 Views | ||
| Go to Top |

