Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                   <a href="" target="_blank"> - Learn Full Stack Development</a>
   <div class="upload-wrapper">
      <h1>Read Text File from Client Side using JavaScript API</h1><br>
         <input type="file" onchange="showFile()">
      <div id="show-text"></div>


                @import url('');

body {
   margin: 2em;
   text-align: center;
   font-family: 'Open Sans';
   background: #ececec
.upload-wrapper {
   background: #ffffff;  
   margin: 30px auto;
   max-width: 650px;
   padding: 20px;
   border: 2px solid #eeeeee;
header {
   padding: 10px 0 30px;
border-bottom: 2px solid #eeeeee;
#show-text {
   padding: 22px 0 5px;
   overflow-y: auto;
   max-height: 400px;
   width: 100%;
.error {
   display: block;
   color: red;
h1 {
   font-size: 22px;
a {
color: blue;
font-size: 13px;
text-decoration: none;
input[type="file"] {
background: #7886d8;
padding: 15px 11px 18px 20px;
border-radius: 4px;
cursor: pointer;
color: white;
width: 159px;
border: 2px solid #3F51B5;
outline: 0;


                   // Check for the various File API support.
   if (window.File && window.FileReader && window.FileList && window.Blob) {
      function showFile() {
         var preview = document.getElementById('show-text');
         var file = document.querySelector('input[type=file]').files[0];
         var reader = new FileReader()

         var textFile = /text.*/;

         if (file.type.match(textFile)) {
            reader.onload = function (event) {
               preview.innerHTML =;
         } else {
            preview.innerHTML = "<span class='error'>It doesn't seem to be a text file!</span>";
   } else {
      alert("Your browser is too old to support HTML5 File API");