Getting MIME type ‘application/octet-stream’ after Uploading a csv file?

  laravel, php

When i try to upload a csvfile its MIME type changes to application/octet-stream. Although i specified enctype="multipart/form-data" in the form, how can i fix that?

<div class="container mt-5">
        <form action="{{route('fileUpload')}}" method="POST" enctype="multipart/form-data">
            <h3 class="text-center mb-5">Download file</h3>
            @csrf
            @if ($message = Session::get('success'))
                <div class="alert alert-success">
                    <strong>{{ $message }}</strong>
                </div>
            @endif

            @if (count($errors) > 0)
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <div class="custom-file">
                <input type="file" name="file" class="custom-file-input" id="chooseFile">
                <label class="custom-file-label" for="chooseFile">Choose file</label>
            </div>

            <button type="submit" name="submit" class="btn btn-primary btn-block mt-4">
                Upload
            </button>
        </form>
</div>

Source: Laravel

Leave a Reply