title: how to insert a file like file.txt or file.html to mysql
body: <p>how to insert the file in mysql to be then downloadable 
  i'm using this code to display the file and insert it in mysql and i've chosen blob the type of the file in mysql. It works correctly but mysql let you download it in a binary format. This is my code </p>
  
  <pre><code>&lt;body&gt;
  &lt;div class="container"&gt;
      &lt;form  name="addform" action="addfile" method="post" accept-charset="utf-8" onSubmit="return Check();"&gt;
          &lt;h2&gt;Adding a service&lt;/h2&gt;&lt;br&gt;&lt;br&gt;
          &lt;div class="row"&gt;
              &lt;label&gt;service name : &lt;/label&gt;&lt;br&gt;
              &lt;input type="text" name="name" placeholder="service name" /&gt;
          &lt;/div&gt;&lt;br&gt;
          &lt;div class="row"&gt;
              &lt;label&gt;file :&lt;/label&gt;&lt;br&gt;
              &lt;input id="upload" type="file"   accept="text/html" size=30 name="fichier" placeholder="service"&gt;
          &lt;/div&gt;&lt;br&gt;
           &lt;textarea class="form-control" rows=20 cols=10 id="ms_word_filtered_html"&gt;&lt;/textarea&gt;
  &lt;br&gt;
          &lt;div class="row"&gt;
              &lt;input class="btn" type='submit' value='Submit'&gt;
              &lt;input class="btn" type='reset' value='Reset'&gt;
              &lt;input class="btn" type='button' value='Back' onclick="javascript: location.href='/'"&gt;
              &lt;br&gt;&lt;br&gt;
              &lt;label class="msgerr"&gt;
                  &lt;%=msg %&gt;
              &lt;/label&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  
  &lt;script&gt;
  function handleFileSelect(evt) {
      var files = evt.target.files; // FileList object
  
      // use the 1st file from the list
      f = files[0];
  
      var reader = new FileReader();
  
      // Closure to capture the file information.
      reader.onload = (function(theFile) {
          return function(e) {
  
            jQuery( '#ms_word_filtered_html' ).val( e.target.result );
          };
        })(f);
  
        // Read in the image file as a data URL.
        reader.readAsText(f);
    }
  
    document.getElementById('upload').addEventListener('change', handleFileSelect, false);
  &lt;/script&gt;
  </code></pre>