Cannot allow gif file type #507

Open
opened 2016-11-24 17:02:16 +00:00 by zhumingvictor · 2 comments
zhumingvictor commented 2016-11-24 17:02:16 +00:00 (Migrated from github.com)

I am trying to allow gif along with other file extensions. But seems it is not allowing gif as it is not included in FileType

I am trying to allow gif along with other file extensions. But seems it is not allowing gif as it is not included in FileType
zhumingvictor commented 2016-11-24 18:55:28 +00:00 (Migrated from github.com)

Work around by adding custom filter:
mFileTypeFilter = {
name: 'mFileTypeFilter', fn: (item: any): boolean => {
let fileExt = item.name.slice(item.name.lastIndexOf('.') + 1).toLowerCase();
return !(this.allowedFileTypes.indexOf(fileExt) === -1);
}
}

Work around by adding custom filter: mFileTypeFilter = { name: 'mFileTypeFilter', fn: (item: any): boolean => { let fileExt = item.name.slice(item.name.lastIndexOf('.') + 1).toLowerCase(); return !(this.allowedFileTypes.indexOf(fileExt) === -1); } }
saravanakumargn commented 2017-01-22 13:14:29 +00:00 (Migrated from github.com)

You can try something like..

        filters: [{
            name: 'owlExtension',
            fn: (item: any): boolean => {
                let fileExt = item.name.slice(item.name.lastIndexOf('.') + 1).toLowerCase();
                //return !(this.allowedFileTypes.indexOf(fileExt) === -1);
                return fileExt === 'gif' ? true : false;
            }
        }]
You can try something like.. ~~~ filters: [{ name: 'owlExtension', fn: (item: any): boolean => { let fileExt = item.name.slice(item.name.lastIndexOf('.') + 1).toLowerCase(); //return !(this.allowedFileTypes.indexOf(fileExt) === -1); return fileExt === 'gif' ? true : false; } }] ~~~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#507