<div class="{{ field.classes }} field-file field-image" data-widget-image>
    
    <div class="preview">
        {% if field.value %}
            <img src="{{ field.value.url }}" alt="" />
        {% else %}
            <img style="display:none;" src="" alt="" />
        {% endif %}
    </div>
    <div class="button">
        <span> {{ field.label }}</span>
        <div>
            {{ field }}
        </div>
    </div>
    <!-- <div class="file-path-wrapper">
        <input class="file-path validate" type="text" {% if field.value %}{{ field.value }}{% endif %}>
    </div> -->
    {% include "workon/forms/fields/__help_and_errors.html" %}
    {% if field.value %}
        {% if not field.field.required %}
        <div class="checkbox">
            <!-- <input type="checkbox" name="{{ field.checkbox_name }}" id="{{ field.checkbox_id }}" /> -->
            <!-- <label style="top: 0;" for="{{ field.checkbox_id }}"  class="{{ form.required_css_class }}">
                <span>Supprimer</span>
            </label> -->
        </div>
        {% endif %}
    {% endif %}

    <script type="text/javascript">
        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#falseinput').attr('src', e.target.result);
                    $('#base').val(e.target.result);
                };
                reader.readAsDataURL(input.files[0]);
            }
        }
    </script>
</div>