dougong2306 2014-06-06 09:31
浏览 31

将条形进度条引入上传文件

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'."
";
                                            echo "The file is valid, and was successfully uploaded.";
                                                echo '<p>&nbsp;</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 ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度