176
rated 0 times
[
180]
[
4]
/ answers: 1 / hits: 35090
/ 5 Years ago, tue, march 19, 2019, 12:00:00
I am using the Ant Design Upload component. Is there a way I can get the content of the selected file as a string in JavaScript in order to display it on the page?
Ideally, I would like to access file.data
or something.
<Upload
accept=.txt, .csv
showUploadList={false}
beforeUpload={(file, fileList) => {
// Access file content here and do something with it
console.log(file);
// Prevent upload
return false;
}}
>
<Button>
<Icon type=upload /> Click to Upload
</Button>
</Upload>
More From » reactjs