Uploading image in an iframe using AJAX

1

I tried to upload an image via AJAX using iframe, but I have no idea how to render the returned image of the function after upload, follow the code:

<form target="frame" action="/painel/empresa/upload" method="post" enctype="multipart/form-data" name="formulario" id="formulario">

<input name="file" type="file"/>

<input type="submit" name="go" value="enviarrrr">

JS:

$(document).ready( function() { 
    $('input').change(function () {

    $('#formulario').submit();
    });

    $.getJSON('/echo/jsonp/?callback=?', function(e, progress) {

    });
  }
);

PHP:

public function upload(Request $request) {

    $data = $request->all();

    $teste = $data['file'];

    $nome = $teste->getClientOriginalName();



    return $nome;
}

Currently it only returns the image name inside the iframe, how can I render this image?

    
asked by anonymous 18.01.2016 / 20:38

0 answers