singh's avatar
Level 1

Laravel 7 - Form with a custom CSS doesn't select file

If I use the following code for my form that is based on Admin Lite theme - it neither selects the file nor uploads it. I can browse through files on my macbook but cannot select one. ' <div class="form-group"> <div class="input-group" > <div class="custom-file">

              ```<form method="POST" action="{{ route('logoupload') }}" enctype="multipart/form-data">```
                      ```@csrf```
                      ```<input type="file" class="custom-file-input" id="logo" name="logo">```
                      ```<input type="hidden" id="companyid"  value="{{ $company->id }}" name="companyid">```
                      ```<label class="custom-file-label" for="logo">Add / Update Logo&lt;/label>```
                  ```</div>```
                    ```<br>```
                  ```<div class="input-group-append">```
                    ```<span class="input-group-text">Upload&lt;/span>```
                  ```</div>```

                  ```</form>```

</div>

<!-- However, if I use the following code everything works fine: -->

<form method="POST" action="{{ route('logoupload') }}" enctype="multipart/form-data"> @csrf <label for="logo">Select file</label> <input type="file" id="logo" name="logo"> <input type="hidden" id="companyid" value="{{ $company->id }}" name="companyid"> <button type="submit" name="Submit"&gt;Submit&lt;/button> </form> What am I doing wrong?

0 likes
4 replies
singh's avatar
Level 1

for some reason i cannot post my html code here

Sinnbeck's avatar

You need to add ``` on the line before and after the code

1 like
ApexLeo's avatar

@singh use &lt; instrad of opening angle bracket for the <form> tag

1 like
Snapey's avatar

Please edit your original question. Your code block is breaking the forum layout for this question.

Please format your code by putting 3 backticks ``` on a line before and after each code block

Please or to participate in this conversation.