php
  • html
  • 2013-01-13 49 views -2 likes 
    -2

    有人可以發現此代碼中的錯誤,它不顯示上傳進度。php表格進度條無法正常工作

    <form action="upload.php" method="post" enctype="multipart/form-data"> 
    <center><p> <input type='file' id='upload_id' size='58' style='height: 30px; font-size: 18px' name='filename'></p> 
    <input type='image' src='<?php echo $menu_upload_button; ?>' onclick="function set() { f=document.getElementById('progress_iframe'); f.style.display='block'; f.src='uploadprogress.php?id=<?=$upload_id?>';} setTimeout(set);"> 
    <iframe id="progress_iframe" src="" style="display:none;" scrolling="no" frameborder="0"></iframe> 
    </form> 
    

    從輸入的功能是這樣的:

    function set() { 
        f=document.getElementById('progress_iframe'); 
        f.style.display='block'; 
        f.src='uploadprogress.php?id=<?=$upload_id?>'; 
    } 
    setTimeout(set); 
    

    uploadprogress.php:

    <META HTTP-EQUIV='REFRESH' CONTENT='1;URL=?id=<?=$_GET['id']?>'> 
    Upload progress:<br /> 
    <?php 
        if(!$_GET['id']) die; 
        $info = uploadprogress_get_info($_GET['id']); 
        $kbytes_total = round($info['bytes_total']/1024); 
        $kbytes_uploaded = round($info['bytes_uploaded']/1024); 
        echo $kbytes_uploaded.'/'.$kbytes_total.' KB'; 
    ?> 
    

    謝謝。

    +1

    請重新設置html標記的格式以獲得可讀性,謝謝。 – arkascha

    +0

    你有任何JS錯誤嗎?最常見的是在onclick屬性中定義一個函數,我建議你將該函數定義移動到'