sftpbrowser/templates/Home/upload.html.twig

58 lines
1.3 KiB
Twig

{% extends "base.html.twig" %}
{% block encoretags %}
{{ encore_entry_link_tags('dropzone') }}
{% endblock %}
{% block body %}
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
<form
action="{{ oneup_uploader_endpoint('sftp') }}"
class="dropzone"
id="mydropzone"
data-maxFiles="0"
style="margin-top:10px">
</form>
{% endblock %}
{% block localscript %}
{{ encore_entry_script_tags('dropzone') }}
<script>
function dropzoneinit( elmt ) {
var totalFiles = 0;
var completeFiles = 0;
elmt.on("sending", function(file, xhr, formData) {
formData.append("folder", "{{ folder }}");
});
elmt.on("addedfile", function (file) {
totalFiles += 1;
});
elmt.on("removed file", function (file) {
totalFiles -= 1;
});
elmt.on("complete", function (file) {
completeFiles += 1;
if (completeFiles === totalFiles) {
console.log("completed");
closeModal();
}
});
}
function dropzonesuccess( file, response ) {
closeModal();
}
function closeModal() {
parent.location.reload();
}
</script>
{% endblock %}