Hello.
I have such a question: is it possible to read the contents of the .txt file without using PHP and IFRAME so that the contents .txt go to TextArea?
Many say it is impossible, but I know that somehow you can do it. Maybe you, wise men, somehow do?
Answer 1, Authority 100%
If from your domain, or from a user computer, then Ajax or HTML5 / File API.
from a computer:
// Somewhere in the layout there is & lt; input id = "inputfile" type = "file" / & gt;
Inputfile.ONCHANGE = FUNCTION () {
var file = inputfile.files [0];
var Reader = New FileReader;
Reader.ONLoadend = Function (EVT) {
textarea.value = Reader.Result; // File Content
};
Reader.Readastext (File);
};
C Server
xhr = new xmlhttprequest;
xhr.open ('Get', '/FileS/foo.txt', True);
Xhr.ONReadyStateChange = Function () {
if (xhr.ReadyState == 4) {
xhr.onreadystatechange = null;
if (xhr.status == 200) {
textarea.value = xhr.responsetext; // File Content
}
}
};
Xhr.send (NULL);