0

i use laravel 53 and try to use http://plugins.krajee.com/ as file input. The problem is: no file upload will be done. This is the relevant part of my blade code:

<form class="form-horizontal" role="form" id="myuseredit" method="POST" action="{{ url('upload') }}" >
...
<div class="col-md-10 ">
    <input id="filedata" name="filedata[]" type="file" multiple class="file-loading">
    <script>
    $("#filedata").fileinput({
        uploadAsync: true,
        maxFileCount: 5
    });
    </script>                       
</div>
</form>
...

And this is the corrosponding controller code:

public function upload(Request $request) {
  dd($request->all());
...

The request shows me only the Name of the original file, what i picked to upload. But nothing more, no upload, no files (on server).

bfo

1 Answer 1

2

If you want to upload files, you have to add enctype="multipart/form-data" to your form tag so the browser knows you want to upload files.

Like so:

<form class="form-horizontal" role="form" id="myuseredit" method="POST" action="{{ url('upload') }}" enctype="multipart/form-data">
Sign up to request clarification or add additional context in comments.

2 Comments

Thats it...for submitting, but for ajax upload i get the json error "SyntaxError: Unexpected token >"
Sorry no, because i have wipe it out and use now only the standard upload - this works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.