Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript php中上载表单的进度条失败_Javascript_Php_Jquery_Css - Fatal编程技术网

Javascript php中上载表单的进度条失败

Javascript php中上载表单的进度条失败,javascript,php,jquery,css,Javascript,Php,Jquery,Css,我的upload.php上有这样一个代码: 调用javascript的语句如下所示: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.js" type="text/javascript"></script> <script> $(document).ready(function() { // //show the progress bar only if a fi

我的upload.php上有这样一个代码:

调用javascript的语句如下所示:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.js" type="text/javascript"></script>
<script>

$(document).ready(function() { 
//

//show the progress bar only if a file field was clicked
    var show_bar = 0;
    $('input[type="file"]').click(function(){
        show_bar = 1;
    });

//show iframe on form submit
    $("ajax-contact-form").submit(function(){

        if (show_bar === 1) { 
            $('#upload_frame').show();
            function set () {
                $('#upload_frame').attr('src','upload_frame.php?up_id=<?php echo $up_id; ?>');
            }
            setTimeout(set);
        }
    });
//

});

</script>

$(文档).ready(函数(){
//
//仅当单击文件字段时才显示进度栏
var show_bar=0;
$('input[type=“file”]”)。单击(函数(){
显示_条=1;
});
//在表单提交上显示iframe
$(“ajax联系人表单”).submit(函数(){
如果(显示条===1){
$(“#上传_帧”).show();
函数集(){
$('upload_frame').attr('src','upload_frame.php?up_id=');
}
设置超时(set);
}
});
//
});
这是代码语句的形式:

<form id="ajax-contact-form" action=""  method="post" enctype="multipart/form-data" name="form1">

    <INPUT type="text" name="name" value="Material Name:" onBlur="if(this.value=='') this.value='Material Name:'" 
                            onFocus="if(this.value =='Material Name:' ) this.value=''">
    <div class="clear"></div><br>
    Choose a file to upload:<br />

<!--APC hidden field-->
    <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="<?php echo $up_id; ?>"/>
    <div class="clear"></div>
<!---->

    <input name="file" type="file" id="file" size="3000"/>
    <div class="clear"></div>
<!--Include the iframe-->
    <br />
    <iframe id="upload_frame" name="upload_frame" frameborder="0" border="0" src="" scrolling="no" scrollbar="no" > </iframe>

<!---->

    <INPUT class="submit" type="submit" name="submit" value="submit">
                  <div class="clear"></div>
  </form>


选择要上载的文件:

这里有一个语法错误:

     setTimeout(set);

setTimeout()
的语法是
setTimeout(函数,毫秒,lang)

第一个快速调试点:您的服务器是否安装了APC?这个上传脚本使用它。它会产生什么错误?Web服务器是不相关的。upload php脚本使用APC扩展跟踪上载进度。因此,您需要检查APC是否已安装并启用。上载一个文件,其中不包含任何其他内容。访问它并查找APC部分。如果它不在那里,就没有安装。我对Azure没有特别的经验,不管你把它放在哪里,或者叫什么名字。只需要您的浏览器就可以访问。您能给我一个简单的例子吗?:)当我查看代码时,已经有一个名为set的函数。延迟是不必要的。因为如果出现错误,我会在调试时看到语法错误。然后使用以下命令:
set()
,就像lee说的,您需要安装超出stackoverflow范围的APC,抱歉