Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
how to change the image url when i paste the link

I work in javascript basically I want to show the image when the user pick the image from the device the image must change the code that I use in the javascript file is

function changeProfile(){

    var location = document.getElementById("profileLocation");
    alert(location.value);
    var image = document.getElementById("profileAAImage");
    image.src(location.value);
}

and the code that I wrote in html file is

<div class="row">
                                <div class="col-md-3 form-group" style="padding-left: 7%;">
                                    <img  id="profileImage" style="border-radius: 200px;" src="images/interne/areab%20suhaib.jpg" class="img-thumbnail" width="100" height="100" >
                                </div>
                                <div class="col-md-9 form-group mt-3 mt-md-0" style="padding-top: 5%;">
                                    <input  type="file" name="file"  class="form-control" id="profileLocation" onclick="changeProfile()" onkeyup="changeProfile()" placeholder="select profile image"
                                            required>
                                </div>
                            </div>

what I do to do the required task.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Change location.value to location.files[0] to get the selected file.

function changeProfile() {
  var location = document.getElementById("profileLocation");
  var image = document.getElementById("profileImage");
  image.src = window.URL.createObjectURL(location.files[0]);
}
<div class="row">
  <div class="col-md-3 form-group" style="padding-left: 7%;">
    <img id="profileImage" style="border-radius: 200px;" src="images/interne/areab%20suhaib.jpg" class="img-thumbnail" width="100" height="100">
  </div>
  <div class="col-md-9 form-group mt-3 mt-md-0" style="padding-top: 5%;">
    <input type="file" name="file" class="form-control" id="profileLocation" onchange="changeProfile()" placeholder="select profile image" required>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda