Display photo in modal / modal edit form

0

I have a form in modal and I want to edit the information of it, but I have to edit the user's photo and when trying to view the photo does not appear or the modal does not work, I would like some help.

HTML

<div class="modal fade" id="editarModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <h4 class="modal-title" id="exampleModalLabel">Alterar Cadastro de Sócio</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Fechar"><span aria-hidden="true">&times;</span></button>
            </div>
            <form method="POST" name="frm" id="frm" action="" enctype="multipart/form-data">
                <div class="modal-body ">
                    <div class="container-fluid">
                        <div class="form-group col-md-6">
                            <img src="../../assets/img/upload/user.png">
                            <input type="file" name="arquivo" id="arquivo">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-dismiss="modal">Cancelar</button>
                    <button type="button" class="btn btn-danger">Alterar</button>
                </div>
            </form>
        </div>
    </div>
</div>

<button type="button" class="btn btn-warning btn-xs" title="Editar dados" data-toggle="modal" data-target="#editarModal" data-whatever="<?=$rst['idsocio']?>" data-foto="../../assets/img/upload/<?=$rst['foto']?>">Editar</button>

Javascript

<script type="text/javascript">
    $('#editarModal').on('show.bs.modal', function(event) {
        var button = $(event.relatedTarget) // Botão que acionou o modal
        var recipient = button.data('whatever') // Extrai informação dos atributos data-*
        var recipientfoto = button.data('foto')
        var modal = $(this)
        modal.find('#idsocio').val(recipient)
        modal.find('img').attr('src', recipientfoto)
    })
</script>
    
asked by anonymous 27.11.2018 / 18:43

0 answers