From 2da5d97280b445ccdfca340f2c9e3a9afabfd849 Mon Sep 17 00:00:00 2001 From: Sam Letts Date: Sat, 28 Jan 2023 14:27:05 +0000 Subject: [PATCH] set accept attribute on input element to only accept images --- projects/ngx-image-compress/src/lib/image-compress.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/ngx-image-compress/src/lib/image-compress.ts b/projects/ngx-image-compress/src/lib/image-compress.ts index f06f37f..d9d30d5 100644 --- a/projects/ngx-image-compress/src/lib/image-compress.ts +++ b/projects/ngx-image-compress/src/lib/image-compress.ts @@ -151,6 +151,7 @@ export class ImageCompress { inputElement.id = 'upload-input' + new Date(); inputElement.style.display = 'none'; inputElement.setAttribute('type', 'file'); + inputElement.setAttribute('accept', 'image/*'); if (multiple) { inputElement.setAttribute('multiple', 'true');