Opening file upload in javascript

I have the following code that opens file upload in javascript. Is there another way to accomplish the same thing with another code?

<div>
      <input
          id="test-id"
          type="file"
          accept="jpg"
          @change=${async (e: Event) => {
             await this.handleImages(e.target as HTMLInputElement, roles);
          }}
      />
      <label for="test-id">Test</label>
</div>