For Javascript use a valid FILE object.
interface FileMessageParams {
new(): FileMessageParams;
file: File;
fileUrl: string;
fileName: string;
fileSize: number;
mimeType: string;
data: string;
customType: string;
thumbnailSizes: Array<ThumbnailSize>;
mentionType: 'users' | 'channel';
mentionedUserIds: Array<string>;
mentionedUsers: Array<User>;
metaArrays: Array<MessageMetaArray>;
metaArrayKeys: Array<string>; // DEPRECATED
pushNotificationDeliveryOption: 'default' | 'suppress';
parentMessageId: number;
}
Something like:
const files = document.getElementById('attachFile').files;
const file = files[0]; // Grab the first (this is a demo only. Need to validate not null and index)
console.dir(file)