Skip to content

Commit

Permalink
fix: entry related files - detect file type upon selection
Browse files Browse the repository at this point in the history
  • Loading branch information
amirch1 committed Aug 14, 2017
1 parent a459304 commit 25b9289
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ export class EntryRelatedHandler extends EntryFormWidget
if (selectedFiles && selectedFiles.length) {

const fileData: File = selectedFiles[0];

const newFile = this._addFile(fileData.name, KalturaAttachmentType.document);
const extension = fileData.name.substr(fileData.name.lastIndexOf(".")+1);
const newFile = this._addFile(fileData.name, this._getFormatByExtension(extension));
(<any>newFile).uploading = true;
(<any>newFile).size = fileData.size;

Expand Down Expand Up @@ -312,11 +312,15 @@ export class EntryRelatedHandler extends EntryFormWidget
case "jpg":
case "jpeg":
case "mp3":
case "mp4":
format = KalturaAttachmentType.media;
break;
case "txt":
format = KalturaAttachmentType.text;
break;
default:
format = KalturaAttachmentType.document;
break;
}
return format;
}
Expand Down

0 comments on commit 25b9289

Please sign in to comment.