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!

2
  • But I want to it with just JavaScript... Commented Feb 5, 2017 at 5:07
  • Sorry about that. Please refer to this StackOverflow question. It may help. stackoverflow.com/questions/34000412/… Commented Feb 5, 2017 at 5:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.