How do I add text from Uploaded document into web page ?

So I have spent literally days trying to upload a text file to the media library and then display the text from the file on a web page

OK I am new but I have read lots and lots before posting on here and maybe it is staring me in the face but I just cannot see it!

The code below is fairly simple to display uploaded image using src but how do I extract & display text from a text document I have uploaded to the media library?

exportfunction button1_click (event) { if ($w(“#uploadButton1”).value.length > 0) { $w(“#text1”).text = “Uploading " + $w(”#uploadButton1").value[0].name; $w(“#uploadButton1”).uploadFiles() .then( (uploadedFiles) => { $w(“#text1”).text = “Upload successful”; $w(“#image1”).src = uploadedFiles[0].fileUrl; }) .catch( (uploadError) => { $w(“#text1”).text = “File upload error”; console.log(“File upload error: " + uploadError.errorCode); console.log(uploadError.errorDescription); }); } else { $w(”#text1").text = “Please choose a file to upload.”; } }

See here:

(in the current question there’s no need to split the text, just to present it)