Search code examples
asp.net-mvcbootstrap-4right-to-left

Bootstrap 4 right to left custom file input


i am trying to make the upload file input direction from bootstrap 4 right to left but nothing i tried so far worked

i also tried to change the direction for different tags

<div class="form-group">
        <div class="col-md-4">
            <div class="custom-file">
                <input type="file" class="custom-file-input" id="customFile" multiple lang="ar" dir="rtl">
                <label class="custom-file-label text-left" for="customFile">choose files to upload</label>
            </div>
        </div>
        <script type="text/javascript">
            $('.custom-file input').change(function (e) {
                var files = [];
                for (var i = 0; i < $(this)[0].files.length; i++) {
                    files.push($(this)[0].files[i].name);
                }
                $(this).next('.custom-file-label').html(files.join(', '));
            });
        </script>
    </div>

bootstrap upload file control style


Solution

  • You would need a little custom CSS like this...

    .custom-file-label::after {
        left: 0;
        right: auto;
        border-left-width: 0;
        border-right: inherit;
    }
    

    Demo: https://www.codeply.com/go/kOURGBHqEX