Skip to content

Instantly share code, notes, and snippets.

@samuelloza
Created March 22, 2017 11:49
Show Gist options
  • Save samuelloza/f60493a406843998f22b22b18d8d93db to your computer and use it in GitHub Desktop.
Save samuelloza/f60493a406843998f22b22b18d8d93db to your computer and use it in GitHub Desktop.
En el controller
$destinationPath = 'uploads/imagenes';
$extension = $request->file("image")->getClientOriginalExtension();
$fileName = rand(11111,99999).'.'.$extension;
$request->file($type)->move($destinationPath, $fileName);
$uri = $destinationPath."/".$fileName;
En la vista para crear
El nombre del $request->file("image") --> image es el mismo que el de name="image"
La uri es la ruta donde se subio el archivo
<form action="{{route("admin.word.store")}}" method="POST" enctype="multipart/form-data" class="form-horizontal">
<input type="hidden" name="_token" id="csrf-token" value="{{ Session::token()}}" />
<input type="file" name="image" id="image" onchange="readURL(this);">
</form>
@alizbren
Copy link

hummm para el momento de listar las imajenes como haces ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment