POST 500(内部错误)php

时间:2016-02-04 15:45:01

标签: php ajax post http-post http-status-code-500

我有这个错误。我在互联网上寻找解决方案,但没找到。 enter image description here

function sendPhoto()
{
    var time = vaxt(new Date());

    $(".mes-all").append("<div class=\"mes-my\"><span class=\"mes-targering\"><span class=\"foto\"><i class=\"fa fa-circle-o-notch fa-spin\" style=\"font-size:30px;color:black\"></i></span></span><span style=\"display:inline\" class=\"mes-my-tr\">"+time+" <i class=\"fa fa-spinner fa-spin\" style=\"margin-left: 4px;\"></i></span></div>");

    scroll();

    var fd = new FormData();    

    fd.append( "file", $(".mes-sending-photo")[0].files[0]);
    fd.append( "to",$(".id").val());

    $.ajax({
        url: "ajax/sendPhoto.php",
        data: fd,
        processData: false,
        contentType: false,
        type: "POST",
        success: function(){
            getMessage();
        }
    });
}

我认为问题出在服务器端而不是代码,但我也无法找到。 错误回复: 远程地址:46.17.40.62:80
请求网址:http://masters.az/ajax/sendPhoto.php 请求方法:POST 状态代码:500内部服务器错误 请求Headersview已解析 POST /ajax/sendPhoto.php HTTP / 1.1 主持人:masters.az 连接:保持活力 内容长度:159591 接受: / 来源:http://masters.az X-Requested-With:XMLHttpRequest User-Agent:Mozilla / 5.0(Windows NT 6.1; WOW64)AppleWebKit / 537.36(KHTML,类似Gecko)Chrome / 37.0.2062.120 Safari / 537.36 内容类型:multipart / form-data;边界= ----
WebKitFormBoundaryB8Wq6VD8CcBe7y9A 推荐人:http://masters.az/message-4

Accept-Encoding:gzip,deflate

Accept-Language:ru-RU,ru; q = 0.8,en-US; q = 0.6,en; q = 0.4


Cookie:login = fuad;口头方式= 12345; ID = 2; CUID = Mw为%3D%3D;

杯= ac4b3abea4ff5ffb14f92d05d18f3c68;登录名=福阿德;口头方式= 12345; ID = 2;

会话= P7ytO93YItgRjUerd5PgJmrO5gN7KIrjPpdlweIDVyeFRG44LTkeDa0IGONagEI4
请求有效负载
------ WebKitFormBoundaryB8Wq6VD8CcBe7y9A

内容处理:表格数据;命名=&#34;文件&#34 ;;文件名=&#34; logo.jpg&#34;

内容类型:image / jpeg

------ WebKitFormBoundaryB8Wq6VD8CcBe7y9A

内容处理:表格数据;命名=&#34;至&#34;

4

------ WebKitFormBoundaryB8Wq6VD8CcBe7y9A--

响应标题查看源

连接:关闭

内容长度:594

内容类型:text / html的

日期:2016年2月4日星期四16:40:13 GMT

服务器:nginx / 1.6.2

php代码是(通过ajax发送的内容):

<?php
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
ini_set('display_errors', 1);
error_reporting(E_ALL);
require("../inc/core.php");
$file=$_FILES['file'];
$tip=$file['type'];
$size=$file['size'];
$t=time();
$yer="../files/mes_images/".$t."_big.png";
$access_size=5*(1000000);
$access_type=array("image/gif","image/jpg","image/jpeg","image/pjpeg","image/x-png","image/png");
if(in_array($tip,$access_type) && $size<=$access_size && !empty($file['name'])){
$q=move_uploaded_file($file['tmp_name'],$yer);
echo $q?"ok":"no";
resize($yer,null,100,100,false,"../files/mes_images/".$t.".png",false,false,100);

$mes="[img]../files/mes_images/".$t.".png[/img]";
$to=$_POST['to'];

$block=leo::mfa("select * from blok where (`by`='$usid' && `to`='$to') || (`by`='$to' && `to`='$usid')  ");
if(!$block){
$check=leo::mfa("select * from `mail` where (`by`='$usid' && `to`='$to') || (`by`='$to' && `to`='$usid') ");
if($check){
$cid=$check['cid'];
}else{
$scid=leo::mfa("select * from `mail` order by cid desc limit 1");
$cid=$scid?$scid['cid']+1:1;
}

$qu=leo::mq("insert into `mail` set `by`='$usid',`to`='$to',mesaj='$mes',vaxt='".time()."',oxu='yox',cid='$cid'");



}


}

}else{
header("location:../err?err=303");
}
?>

0 个答案:

没有答案