1
I tried to upload an image via AJAX using iframe, but I have no idea how to rewrite the image returned from 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 returns only the name of the image inside the iframe, how can I render this image?