5
Hi, I would like to know how to get the path of an image contained in the value of a file type input. I am using the following code:
$(document).on("change",'#Upload',function(){
var valor=$(this).attr('value');
var ext= (valor.substring(valor.lastIndexOf("."))).toLowerCase();
if (ext==".jpg" || ext==".jpeg"){
$("#Image").attr("src", valor);
}else{alert('Extensao "'+ext+'" nao permitida!');}
});
It returns a fakepath, ie a false path. someone could help me?
Barter
var valor=$(this).attr('value');forvar valor=$(this).val();does not solve the problem?– Michael Siegwarth
It also returns the following value: C:/fakepath/imagem_teste.jpg
– William Lima
I believe browsers do not allow you access to the original directory due to user security issues.
– Cahe
Some way to make a kind of image visualization to be loaded on the page itself?
– William Lima
It’s a localhost page?
– Felipe Viero Goulart