Created
November 5, 2015 20:02
-
-
Save MAAARKIN/e9ebda998828c21a8087 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="file_upload" action="${linkTo[FileBankController].uploadRetorno}" method="POST" enctype="multipart/form-data"> | |
<div class="row fileupload-buttonbar"> | |
<div class="col-lg-7"> | |
<!-- The fileinput-button span is used to style the file input field as button --> | |
<span class="btn btn-success fileinput-button"> <i | |
class="glyphicon glyphicon-plus"></i> | |
<span>Add files...</span> | |
<input id="fileupload" type="file" name="files[]" multiple> | |
</span> | |
<button type="submit" class="btn btn-primary start"> | |
<i class="glyphicon glyphicon-upload"></i> | |
<span>Start upload</span> | |
</button> | |
<span class="fileupload-process"></span> | |
</div> | |
</div> | |
<!-- The table listing the files available for upload/download --> | |
<table role="presentation" class="table table-striped"> | |
<tbody class="files" id="uploaded-files"></tbody> | |
</table> | |
</form> | |
<script language=Javascript> | |
$(document).ready(function(){ | |
$('#fileupload').fileupload({ | |
acceptFileTypes: /(\.|\/)(txt)$/i | |
}).bind('fileuploadadded', function (e, data) { | |
$.each(data.files, function (index, file) { | |
$("#uploaded-files") | |
.append($('<tr/>') | |
.append($('<td/>').text(file.name)) | |
.append($('<td/>').text(file.size)) | |
.append($('<td/>').text(file.type)) | |
.append($('<td/>').html('<a class="btn btn-warning cancel">' + | |
'<i class="glyphicon glyphicon-ban-circle"></i>' + | |
'<span>Cancel</span> </a>'))) | |
}); | |
}).bind('fileuploadprocessfail', function (e, data) { | |
alert(data.files[data.index].error); | |
}); | |
}); | |
$(document).on('click', '.cancel', function() { | |
$(this).closest('tr').remove(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment