Jump to content
Worm64

Read local files using pure javascript

Recommended Posts

Posted

Scris de dimineata la cafea:


<script>
function citeste(file)
{
fisier=new FileReader()
fisier.onload = function(e) {
var text = fisier.result;
document.getElementById('display').innerHTML=text;
}
fisier.readAsText(file,'UTF-8')
}
</script>
<input type="file" id="fileInput">
<input type='button' value='Citeste' onclick='citeste(fileInput.files[0])'></br>
<textarea id='display' style='height:80%; width: 30%;'>
</textarea>

  • Upvote 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...