Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
¿Cómo puedo agregar un dominio al archivo cuando intento cambiar la imagen?

Estoy tratando de cargar y cambiar la imagen con jQuery. La carga funciona bien y la respuesta en ajax parece la esperada. En la consola obtuve grfx/adam del resultado variable, pero en la etiqueta img aparece el error 404 no encontrado y parece que agregó un dominio o algo así. El src se parece a http://localhost:8080/HM/%EF%BB%BF%20grfx/adam.jpg y el resultado es un icono img roto. La función Javascript se ve así:

 <script> function uploadprofilepic() { $('#formupload').hide(); $('#formcrop').show(); // Making the image file object var file = $('#newprofilepic').prop("files")[0]; // Making the form object var form = new FormData(); // Adding the image to the form form.append("image", file); // Adding the image to the form form.append("image", file); // The AJAX call $.ajax({ url: "uploadprofilepicture.php", type: "POST", data: form, contentType: false, processData:false, success: function(result){ // byter bild lokalt i hållare console.log(result); $('#picholder').attr("src", result); } }); } </script>

¿Qué podría estar mal? ¡gracias de antemano!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Parece que su código es correcto pero tiene curiosidad acerca de la url http://localhost:8080 , ¿es backend o front-end? Si esta es la URL de la interfaz, entonces debe verificar dónde se encuentra esta imagen y establecer la URL del dominio adecuada

Espero que seas claro con esto.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!