7921 Posts in 1359 Topics by 933 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 | Next > | |
| Author | Topic: | 3097 Views |
-
setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 3:36am Last edited: 26 November 2010 4:09am
Question:
When using uploadify+FileDOM:Added in the code:
$manager->setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe'));
But cant upload a docx for example.. it doesn;t recognize it!
It will just links to the URL: '/new-page' - which does not existDebug mode is on but doesn't give an error i think:
script: %2Fadmin%2FEditForm%2Ffield%2FDownloads%2FUploadifyForm%2Ffield%2FUploadedFiles%2Fupload
refreshlink: /admin/EditForm/field/Downloads/UploadifyForm/field/UploadedFiles/refresh?ctf[Downloads][start]=0&ctf[Downloads][per_page]=10&ctf[Downloads][showall]=0&ctf[Downloads][sort]=SortOrder&ctf[Downloads][sort_dir]=&ctf[Downloads][search]=&ctf[Downloads][filter]=&ctf[Downloads][view]=
uploader: /uploadify/javascript/uploadify.swf
scriptAccess: sameDomain
queueSizeLimit: 40
auto: 1
fileExt: *.pdf;*.PDF;*.doc;*.DOC;*.docx;*.DOCX;*.xls;*.XLS;*.xlsx;*.XLSX;*.psd;*.PSD;*.ai;*.AI;*.zip;*.ZIP;*.rar;*.RAR;*.exe;*.EXE
fileDesc: Downloads(pdf,doc,docx,xls,xlsx,psd,ai,zip,rar,exe)
cancelImg: /uploadify/images/cancel.png
image_class: Image
file_class: File
buttonText: Upload files
queueID: UploadifyFieldQueue_UploadedFiles
wmode: transparent
hideButton: 1
upload_on_submit:
sortable:
sizeLimit: 16777216
multi: 1
scriptData:When uploading a RAR i get the 'HTTP error', but the debugger doesn't show any error.
Checked my dataBase and there are no 'null' classes in col 'ClassName'
Files are just called 'File' -
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 4:35am
See File::$allowed_extensions.
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com -
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 4:44am
don't want to be rude again, but where can i find File::$allowed_extensions
Tried the forums, but wasn't too helpfull. -
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 4:51am
should i do it like this, in _config:
File::$allowed_extensions() = 'rar';
File::$allowed_extensions() = 'doc';
File::$allowed_extensions() = 'docx';etc?
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 5:02am
ok tried this way, don't know if it is correct:
class Download extends DataObject {
...
static $allowed_extensions = array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe');
...}
But this didn't work.
When uploading a 'Test.doc' .. after upload -> it just says: new-file
What am i doing wrong? -
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 5:23am Last edited: 26 November 2010 5:23am
OK.. maybe its no the filetypes, but something else.
Because:
sapphire\filesystem\File.php
already says:
public static $allowed_extensions = array(
'','html','htm','xhtml','js','css',
'bmp','png','gif','jpg','jpeg','ico','pcx','tif','tiff',
'au','mid','midi','mpa','mp3','ogg','m4a','ra','wma','wav','cda',
'avi','mpg','mpeg','asf','wmv','m4v','mov','mkv','mp4','swf','flv','ram','rm',
'doc','docx','txt','rtf','xls','xlsx','pages',
'ppt','pptx','pps','csv',
'cab','arj','tar','zip','zipx','sit','sitx','gz','tgz','bz2','ace','arc','pkg','dmg','hqx','jar',
'xml','pdf',
);When uploading various files types (txt, psd, docx, doc, xls, xlsx) i only succeed uploading ZIP and XLS
The popup renames the 'unknown files' to 'new-file' which has no reference to the uploaded file -> just a 404
Im beginning to believe this is a bug?
Or what am i doing wrong?Also see the popup
By borriej at 2010-11-25Notice the rar not being uploaded and the docx called new-file.
When clicking continue in the popup i redirect tot a 404
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 5:47am
You can add to your _config.php:
File::$allowed_extensions[] = "some extension";
-
Re: setAllowedFileTypes(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'psd', 'ai', 'zip', 'rar', 'exe')); - Still need help!

26 November 2010 at 5:58am
Also tried that UncleCheese
But i'm afraid that didnt solve it.. still upload file types that get renamed to new-file without any reference
| 3097 Views | ||
| Go to Top | Next > |
