mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: user-friendly error now present for unwanted upload file types
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114132 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b15019a95f
commit
3ffa3bfe42
@ -175,7 +175,13 @@ class FileIFrameField extends FileField {
|
||||
if($data['FileSource'] == 'new') {
|
||||
$fileObject = Object::create($desiredClass);
|
||||
|
||||
$this->upload->loadIntoFile($_FILES['Upload'], $fileObject, $this->folderName);
|
||||
try {
|
||||
$this->upload->loadIntoFile($_FILES['Upload'], $fileObject, $this->folderName);
|
||||
} catch (Exception $e){
|
||||
$form->sessionMessage(_t('FileIFrameField.DISALLOWEDFILETYPE', 'This filetype is not allowed to be uploaded'), 'bad');
|
||||
Director::redirectBack();
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->upload->isError()) {
|
||||
Director::redirectBack();
|
||||
|
@ -240,6 +240,7 @@ $lang['en_US']['File']['Title'] = 'Title';
|
||||
$lang['en_US']['FileIFrameField']['ATTACH'] = 'Attach %s';
|
||||
$lang['en_US']['FileIFrameField']['ATTACHONCESAVED'] = '%ss can be attached once you have saved the record for the first time.';
|
||||
$lang['en_US']['FileIFrameField']['DELETE'] = 'Delete %s';
|
||||
$lang['en_US']['FileIFrameField']['DISALLOWEDFILETYPE'] = 'This filetype is not allowed to be uploaded';
|
||||
$lang['en_US']['FileIFrameField']['FILE'] = 'File';
|
||||
$lang['en_US']['FileIFrameField']['FROMCOMPUTER'] = 'From your Computer';
|
||||
$lang['en_US']['FileIFrameField']['FROMFILESTORE'] = 'From the File Store';
|
||||
|
Loading…
Reference in New Issue
Block a user