adding multiple files upload feature
This commit is contained in:
@@ -55,11 +55,20 @@
|
||||
<ul class="nav navbar-nav navbar-right" id="main-nav">
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
{% if g.user.role_upload() or g.user.role_admin()%}
|
||||
{% if g.allow_upload %}
|
||||
<li>
|
||||
<form id="form-upload-multi" class="navbar-form" action="{{ url_for('upload_multi') }}" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<span class="btn btn-default btn-file">{{_('Upload')}} multi files<input id="btn-upload-multi" name="btn-upload" type="file" multiple></span>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if g.allow_upload %}
|
||||
<li>
|
||||
<form id="form-upload" class="navbar-form" action="{{ url_for('upload') }}" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<span class="btn btn-default btn-file">{{_('Upload')}} <input id="btn-upload" name="btn-upload" type="file"></span>
|
||||
<span class="btn btn-default btn-file">{{_('Upload')}} a single file<input id="btn-upload" name="btn-upload" type="file"></span>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
@@ -98,6 +107,14 @@
|
||||
</div>
|
||||
{%endif%}
|
||||
{% endfor %}
|
||||
<div id="loader" hidden="true">
|
||||
<center>
|
||||
<h3>Uploading...</h3>
|
||||
<span>please don't refresh the page</span>.
|
||||
<br />
|
||||
<img src="{{ url_for('static', filename='img/loader.gif') }}">
|
||||
</center>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||
@@ -224,11 +241,16 @@
|
||||
<script src="{{ url_for('static', filename='js/libs/jquery.form.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#btn-upload").change(function() {
|
||||
$("#form-upload").submit();
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
$("#btn-upload").change(function () {
|
||||
$("#loader").show();
|
||||
$("#form-upload").submit();
|
||||
});
|
||||
$("#btn-upload-multi").change(function () {
|
||||
$("#loader").show();
|
||||
$("#form-upload-multi").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% block js %}{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user