Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera uno-de-piera/form.blade.php Secret
Last active Jun 10, 2019

Embed
What would you like to do?
@section('content')
<div class="card">
<div class="card-body">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
{{ Form::model($course, ['url' => route('upload_s3'), 'files' => true]) }}
<div class="form-group">
{{ Form::label('Imagen', null, ['class' => 'control-label']) }}
{{ Form::file('upload') }}
</div>
<div class="form-group btn.purple">
{{ Form::submit('Subir archivo') }}
</div>
{{ Form::close() }}
</div>
</div>
@stop
<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
Route::post('upload', function () {
$file = request()->file('upload');
$upload = Storage::disk('s3')->put('courses/' . $file->getClientOriginalName(), $file, 'public');
})->name('upload_s3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.