Use enctype="multipart/form-data" in your form tag.
Jul 22, 2016
10
Level 2
Laravel - uploading pdf via form
Guys, you've helped me before and I believe you'll give me a hint this time.
I've built a form and a controller and it does what I need apart from uploading the file. It does not spit any errors, though.
Here is my form:
<form method="POST" action="/ijps" role="form">
<div class="form-group">
<textarea name="autor" class="form-control"></textarea>
</div>
<div class="form-group">
<textarea name="tytul" class="form-control"></textarea>
</div>
<div class="form-group">
<textarea name="rok" class="form-control"></textarea>
</div>
<div class="form-group">
<textarea name="issue" class="form-control"></textarea>
</div>
<div class="form-group">
<label for="plik">Plik</label>
<input type="file" id="plik">
</div>
<input type="hidden" name="_token" value="{!! csrf_token() !!}">
<button type="submit" class="btn btn-primary">Wyślij</button>
</form>
```
and here is my controller:
public function store(Request $request) {
$ijp = new Ijp;
$ijp->create($request->all());
}
What am I doing wrong?
Please or to participate in this conversation.