我在引入条形进度方面遇到了问题。当我点击提交时,我想要一个进度条出现在标签进度中,直到页面被定向到另一个页面说“已发送消息” 以下是我的代码的摘录:
<?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>';
}
}
... ?>
这是有问题的表单,它将数据发送到上一个函数
<?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>'; ?>
如何在此代码中添加进度条?