<script type="text/javascript" src="{{STATIC_URL}}django_s4/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}django_s4/s4-drive-upload.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $("#upload_{{name}}").click(function(){
        file = $("#file_{{name}}")[0].files[0];
        console.log(file);
        s4Upload("{{url}}", file, function(data){
            $("#input_{{name}}").val(data);
            $("#path_{{name}}").html(data);
            $("#path_{{name}}").attr("href", "{{DRIVE_STATIC_URL}}"+data);
        })
    })
    $("#remove_{{name}}").click(function(){
        $("#input_{{name}}").val("");
        $("#path_{{name}}").html("");
        $("#path_{{name}}").removeAttr("href");
    })
})

</script>
<input type="file" id="file_{{name}}">
<a id="upload_{{name}}" class="button">upload</a>
<input type="hidden" name="{{name}}" id="input_{{name}}" value="{{value}}">
<a href="{{DRIVE_STATIC_URL}}{{value}}" id="path_{{name}}">{{value}}</a>
<a id="remove_{{name}}" class="button">remove</a>