mistery_girl mistery_girl - 1 year ago 355
CSS Question

Style input type file in Laravel

I'm trying to style input type file using Laravel ->


<div class="col-md-3">
{{ Form::file('images[]', ["class"=>"required","multiple"=>true]) }}

It should look like that:
enter image description here

I've searcched in web for some solutions and there are possibilities with js but in some of them it's commented that it's not always working in all browsers.

What should be the right way to do that?

Answer Source

you can solve this through "label" tag.

<label for="form-file">Upload a file</label>
<input type="file" name="file" id="form-file" class="hidden" />

Just hide the input with css or move it somewhere -9999px to the left, and style the label element to whatever you desire. When user will click on label it will show the upload popup.

I hope this help.

EDIT: Here is example. With "Form::file" you can just add label and add ID parametr to your function.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download