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

143
Views
Mostrar la imagen que elijo antes de hacer clic en actualizar con Symfony 5.4

Necesito editar una clase llamada "aula" que tiene los atributos id, nombre, profesor e imagen. Hasta ahora, la carga y edición de imágenes en la base de datos está funcionando, pero en la página de edición me gustaría mostrar la nueva imagen antes de hacer clic en el botón de actualización. He hecho algo pero nada funciona si alguien me puede ayudar por favor.

El código de la edición de la vista:

 {% block title %}Edit Classe{% endblock %} {% block body %} <h1>Edit Classe</h1> {{ form_start(form) }} {{ form_errors(form) }} {{ form_row(form.nom) }} {{ form_row(form.enseignant) }} {{form_row(form.image)}} <img id="output" src="{{ asset('img/course/small/'~ classe.image) }}" alt="course" class="card-img card-img-horizontal-lg sh-18 sw-lg-16 h-lg-100"> {{ form_row(form.cours) }} {{ include('classe/_form.html.twig', {'button_label': 'Update'}) }} {{ form_end(form) }} <script> function file_changed(){ var selectedFile = document.getElementById('input').files[0]; var img = document.getElementById('img') var reader = new FileReader(); reader.onload = function(){ img.src = this.result} reader.readAsDataURL(selectedFile); } </script> {% endblock %}
about 4 years ago · Juan Pablo Isaza
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!