0

I have this code

    <input type="file">
  <script>
  $('input').change(function (e) {
    var blob = new Blob(["<?php echo 'Hola'; ?>"], {
      name:"prueba2.php",
      type: 'text/php' });
    var pathsito = URL.createObjectURL(blob);
    window.open(pathsito);
    console.log(e.target.files[0])
  })
  </script>

And what I try to do with this code is to make a blob PHP file and then make a jQuery AJAX request to execute the code of the Blob file, but by now i just want to make sure that the file work as php file and it prints only "Hola" when the window is opened, but... no! it always think that the file is a .txt file even if I change type in the object.

Please a solution, Please!

JosephDFGX
  • 216
  • 3
  • 6
  • But I want to it with just JavaScript... – JosephDFGX Feb 05 '17 at 05:07
  • Sorry about that. Please refer to this StackOverflow question. It may help. http://stackoverflow.com/questions/34000412/how-do-i-convert-url-to-blob-with-javascript-or-jquery –  Feb 05 '17 at 05:09

0 Answers0