Hi everyone, I started learning Forge and I want to create a app.
I am using the UI Kit 2 and I want to upload a file to do things with it.
But I read the docs and I don’t find a way to upload a file.
Can someone tell me if is it possible or not ?
Thanks you.
Hi @MathieuMafille ,
I use npm file-saver.
import * as FileSaver from 'file-saver';
FileSaver.saveAs(data, downloadFileName);
Hi, thanks for your response but it doesn’t helps me.
I want to have a UI button to upload a file.
Like this in HTML:
<form action="/action_page.php">
<input type="file" id="myFile" name="filename">
<input type="submit">
</form>
Thanks for your help.
I realise this is kinda old, but you can use the UI Kit component <Textfield type=“file”> to get a file picker, which returns a file target, however it looks like the file data via target.files[0] is disableb somehow.
See FileReader as a way of reading the file data once you have it Using files from web applications - Web APIs | MDN
If I find a way to do it I’ll update here. Did you figure out how to do it?
OK looks like UI Kit mucks with the event target so there is no files FileList attached, and so no FilePrototype to get the file from.
Using Custom UI you can do browser stuff as per the MDN link above and it will work.