Input file tag is not working UXP

Hello Everyone!
I am currently developing a file chooser component for the UXP plugin. However, I have encountered an issue when using the following HTML tag:

input type=“file” accept=“application/pdf” onChange={handleFileChange}

This implementation results in only the text field being displayed, without the expected file input functionality.

Could anyone provide insight into why this is occurring? Additionally, any workarounds or alternative solutions would be greatly appreciated.

Thank you in advance for your assistance.

-yajiv

To open file you need to use the following code:
const localFileSystem = require(‘uxp’).storage.localFileSystem;
await localFileSystem.getFileForOpening({allowMultiple: true/false, types: [“png”, “jpg”]});
Documentation: getFileForOpening

Hi Liryk,
Thank you for the prompt response.
If I used the getFileForOpening functionality, I would get a different type of file system object, like the screenshot below.

However, I need a file system object from the HTML input file tag in the screenshot below.
image

I don’t think UXP supports this.
Here you can check supported html tags https://developer.adobe.com/xd/uxp/develop/reference/uxp/ui-html-index/

1 Like

UXP doesn’t support <input type=file> as documented here. As @Liryk has responded earlier, getFileForOpening is the recommended approach to show file pickers from a UXP panel. Since UXP doesn’t support File, it won’t be helpful to try to obtain it in a UXP panel context.

1 Like