I am developing a text editor, I am trying to upload live files, where you load the file and it appears in the text editor similar to word, I am doing it without a form
so it is more complicated to process it with PHP, I want that when loading the file this immediately load it in the server, open it and execute it in the client with AJAX
//INPUT FILE
$("input[name=loadtxt]").change(function(event){
$.ajax({
url:'http://localhost/proyecto_servidor/loadtxt.php?file='+this.files[0],
method:'POST',
success:function(data){
//response here
},
error:function(data){
console.log(data);
}
});
});
<input type='file' name='loadtxt' accept='.txt' class='firepad-btn firepad-dropdown'>
Try sending it by the URL, and it arrives in PHP as (Object File) but you can not access these variables offered by the file such as name, size etc, the idea is that in php, open the file with that name and I loaded it with fopen