Level 41
The error has nothing to do with the maximum size of uploaded, show us some code...
Hello guys,
i am playing with my small app where i want to upload some pictures via form. When I put there files which are bigger than 5MB I get a mismatched token error. I did not have a problem with this in L4, however since then i started using homestead machine on my mac. Are there any settings either in Laravel 5 or Homestead which would influence the maximum size of uploaded files?
Thank you for your answers
The error has nothing to do with the maximum size of uploaded, show us some code...
This is my controller:
public function store(RealisationRequest $request)
{
$realisation = new Realisation;
$realisation->title = $request->title;
$realisation->year = $request->year;
$realisation->finalisation = $request->finalisation;
$realisation->folder = uniqid();
$this->savepictures($realisation->folder, $request);
$realisation->save();
return redirect('/home');
}
protected function savepictures($folder, RealisationRequest $request)
{
$image0 = $request->file('cover_photo');
$image1 = $request->file('photo_1');
$image0->move(public_path() . '/upload/' . $folder, 'cover_photo.jpg');
$image1->move(public_path() . '/upload/' . $folder, 'photo_1.jpg');
}
This is the form:
<div class="row">
<div class="col-md-8">
{!! Form::open(['method' => 'POST','action' => 'RealisationController@store','files' => true]) !!}
<!-- Title Form Input -->
<div class="form-group">
{!! Form::label('title','Title:') !!}
{!! Form::text('title',null,['class' => 'form-control']) !!}
</div>
<!-- Author Form Input -->
<div class="form-group">
{!! Form::label('year','Year:') !!}
{!! Form::text('year',null,['class' => 'form-control']) !!}
</div>
<!-- Text Form Input -->
<div class="form-group">
{!! Form::label('finalisation','Finalisation:') !!}
{!! Form::text('finalisation', null, ['class' => 'form-control']) !!}
</div>
</div>
<div class="col-md-4">
<label>Cover Photo</label>
<div class="form-group">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail upload_photo --cover_photo" data-trigger="fileinput">
</div>
<div>
<span class="btn btn-default btn-file"><span class="fileinput-new">Select image</span><span
class="fileinput-exists">Change</span><input type="file" name="cover_photo"></span>
<a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<label>Photo 1</label>
<div class="form-group">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail upload_photo --photo" data-trigger="fileinput">
</div>
<div>
<span class="btn btn-default btn-file"><span class="fileinput-new">Select image</span><span
class="fileinput-exists">Change</span><input type="file"
name="photo_1"></span>
<a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
</div>
</div>
</div>
</div>
<div class="col-md-12">
{!! Form::submit('Submit', ['class' => 'btn btn-primary btn-lg btn-block']) !!}
{!! Form::close() !!}
</div>
@include('errors.form')
</div>
I think your code is correct, this may help you.
Please or to participate in this conversation.