I am working on the following laracast: https://laracasts.com/series/build-project-flyer-with-me/episodes/11
I am at the part where your using the request object to get the uploaded files. However, every file that I upload is coming through as an octet stream and has a file size of 0. Any ideas why this might be?
flyers/show.blade.php:
@extends('layout')
@section('content')
<h1>{{ $flyer->street }}</h1>
<h2>{!! $flyer->price !!}</h2>
<hr/>
<div class="description">{!! nl2br($flyer->description) !!}</div>
<form action="/{{ $flyer->zip }}/{{ $flyer->street }}/photos" method="POST" class="dropzone" enctype="multipart/form-data">
{{ csrf_field() }}
</form>
@stop
@section('scripts.footer')
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.2.0/dropzone.js"></script>
@stop
Controllers/FlyersController.php:
public function addPhoto(Request $request)
{
$file = $request->file('file');
return $file->getClientSize();
}
So I ended up using $request->file('file')->getErrorMessage() and found out:
The file "100_0394.JPG" exceeds your upload_max_filesize ini directive (limit is 2048 KiB).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community