使用jquery 500内部服务器错误

时间:2012-12-25 10:07:05

标签: php jquery mysql

我将500内部服务器错误输入firebug。这个代码在localhost上工作得很好。请帮助我。这是我的代码。我正在上传文件,这就是为什么我已经将动作也用于标记。

<script src="js/jquery.form.js"></script> 
<script src="js/create_input.js"></script>
<script> 
    $(document).ready(function() { 
        $('#UploadForm').on('submit', function(e) { 
            e.preventDefault();
                            var value= $("#valS").val();
                            var host=$('#host').val(); alert(host);
            $(this).ajaxSubmit({
                type: "POST",
                url: host+"views/excel_import.php",
                data: {value: value},
                target: '#Exceloutput',
                success:  afterMsg //call function after success
            });  
        });
    }); 

    function afterMsg(msg)  { 

        $("#Exceloutput").html(msg);

    } 


</script> 

<form action="http://localhost/shop/admin/views/excel_import.php" method="post" enctype="multipart/form-data" id="UploadExcel" class="form has-validation">

  <div class="clearfix">
           <label for="form-upload" class="form-label">Upload File<em>*</em></label>
           <div class="form-input">
               <input type="file" size="50" class="text" id="excelfile" name="excelfile" required="required"/>
               <input type="hidden" size="50" class="text" id="valS" name="valS" value="1" required="required"/>
           </div>
  </div>

 <div class="form-action clearfix">
         <button class="button class-button" type="submit" id="SubmitButton">Upload</button>
         <button class="button class-button" type="submit" id="updatefields" name="updatefields">UpdateExcel</button>
 </div>

3 个答案:

答案 0 :(得分:0)

我没有看到很多变量被定义。

主机?

url: host+"views/excel_file_import.php",

值?

data: {value: value},

除了500之外,你的控制台是否有任何错误?听起来你的脚本可能有问题。 * excel_file_import.php *中的相关代码是什么,特别是处理POST参数的部分......

答案 1 :(得分:0)

如果您在服务器上使用此代码,则该URL指向localhost,这可能是错误的,除了跨站点浏览器限制问题之外。

Serverside 500错误,我要做的第一件事就是分别检查webservers错误日志或php-cgi错误日志。

googling之后,此looks a lot like your error消息:

集:

FcgidMaxRequestLen 2000000

which equals roughly 2 MB.

The default value is

FcgidMaxRequestLen 131072

所以,改变那个价值。您的POST大小超过了上传限制。

答案 2 :(得分:0)

从提供的错误消息中我猜你正在使用mod_fcgid所以你应该编辑文件:

/etc/apache2/mods-available/fcgid.conf

并将MaxRequestLen的值添加(或更改)为更大的数字。 文件路径是mode_fcgi的默认路径,但如果您有任何控制面板(cpanel,parallels)可能需要编辑vhost fcgid,则文件路径可能会有所不同。

相关问题