I've got a problem for introduce a bar progress.When I click on submit, I want a progress bar that appears in the tag progress until the page is directed to another page to say "The message has been sent" Here is an excerpt from my code :
<?php
define('MB', 1048576);
$today = getdate();
$nb =$today[0];
$extensions = array('.rar','.zip');
$extension = strrchr($_FILES['userfile']['name'], '.');
echo '<pre>';
$nomFichier= $_FILES['userfile']['name'];
$info = pathinfo($nomFichier);
$file_name =$nb.'.'.$info['extension'];
$uploaddir = 'uploads/';
$uploadfile = $uploaddir .$file_name;
if(in_array($extension, $extensions)){
if ($_FILES['userfile']['size'] < 100*MB){
if (mail($mail,$sujet,$message,$header) AND move_uploaded_file($_FILES['userfile'] ['tmp_name'], $uploadfile)){
echo 'The message has been sent'."\r\n";
echo "The file is valid, and was successfully uploaded.";
echo '<p> </p>';
echo '<button class="btn btn-default btn-lg" OnClick="window.location.href=\'service.php\'">Return</button></div>';
}
}
... ?>
here is the form in question, which sends the data to the previous function
<?php
echo '<form role="form" method="post" action="envoiService2.php" enctype="multipart/form-data">
<div class="form-group">
<label for="lastName">Last Name</label>
<input type="text" class="form-control" id="lastName" placeholder="Enter Last Name" name="nom">
</div>
<<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" id="fileControl" value="label" name="userfile" enctype="multipart/form-data">
<p class="help-block">Only ".rar" or ".zip" format </p>
</div>
<button type="button" class="btn btn-primary " onclick="uploadFile()" name="uploadFiles" value="Upload the files">Send</button>
</form>
<progress id="progressBar" value="0" max="0">
</progress>
<div id="percentageCalc">
</div>';
echo '</div>'; ?>
How can I put a progress bar in this code, please ?