63 lines
1.5 KiB
PHTML
63 lines
1.5 KiB
PHTML
|
<div>
|
||
|
|
||
|
<h2>Intégration d'un fichier</h2>
|
||
|
|
||
|
<p>Taille maximale d'un fichier : <?=$this->filesize?></p>
|
||
|
|
||
|
<form enctype="multipart/form-data" name="sendfile" action="<?=$this->url(array('controller'=>'enrichissement','action'=>'fileupload'))?>" method="post">
|
||
|
<input type="hidden" name="APC_UPLOAD_PROGRESS" id="key" value="<?=uniqid()?>"/>
|
||
|
|
||
|
<div class="fieldgrp">
|
||
|
<label>Sélection d'un client</label>
|
||
|
<div class="field">
|
||
|
<select name="client">
|
||
|
<option value=""></option>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="fieldgrp">
|
||
|
<label>Référence</label>
|
||
|
<div class="field"><input type="text" name="ref" /></div>
|
||
|
</div>
|
||
|
|
||
|
<div class="fieldgrp">
|
||
|
<label>Fichier</label>
|
||
|
<div class="field">
|
||
|
<input type="file" id="fichier" name="fichier"/>
|
||
|
<input type="submit" value="Envoi"/>
|
||
|
|
||
|
<div id="progressbar"></div>
|
||
|
<div id="output"></div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</form>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
var timer;
|
||
|
|
||
|
$('form[name=sendfile]').ajaxForm({
|
||
|
beforeSubmit: function() {
|
||
|
timer = setInterval(checkProgress,200);
|
||
|
$('#progressbar').reportprogress(0);
|
||
|
$('#output').html('Envoi en cours...');
|
||
|
},
|
||
|
success: function(data) {
|
||
|
clearInterval(timer);
|
||
|
$('#progressbar').remove();
|
||
|
$('#output').html('<strong>' + data + '</strong>');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
function checkProgress() {
|
||
|
$.get('<?=$this->url(array('controller'=>'enrichissement', 'action'=>'fileprogress'))?>',
|
||
|
{key: $('#key').val()}, function(data) {
|
||
|
var percent = data.current/data.total*100;
|
||
|
$('#progressbar').reportprogress(percent);
|
||
|
}, 'json');
|
||
|
}
|
||
|
</script>
|