0
How can I check using Javascript or jQuery that a file exists ?
OBS: I opened the question and already answered.
0
How can I check using Javascript or jQuery that a file exists ?
OBS: I opened the question and already answered.
1
Below are the means I found.
function verificaUrl(url) {
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
return http.status != 404;
}
$.ajax({
url:'http://www.exemplo.com.br/arquivo.txt',
type:'HEAD',
success: function() {
//arquivo existe
}
error: function() {
//arquivo não existe
},
});
that’s the answer?
this checks a url and not the existence of a file...
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
What you’ve already done?
– Maniero
@Bigown Has in the answer below.
– Allan Ramos
:D is that I analyzed in the queue, showed nothing
– Maniero
Exists on the server or the computer of who is viewing the page?
– bfavaretto