欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

上传图片回调出错,同一个回调函数,只是换了不同的域名,线上服务器可以,测试服务器报错,返回 579 错误怎么回事?

程序员文章站 2024-01-01 20:44:10
...
1.问题描述:
七牛上传图片,同样的回调函数,在测试服务器上回调报错,报579错误,但是在线上服务器可以上传,而且之前在测试服务器上传是没有问题的,一段时间后有问题了。

2.回到函数:
public function qiniuUploadCallback(){

    $data['key'] = $_POST['filetype'];
    $data['name'] = $_POST['fname'];
    $data['size'] = $_POST['fsize'];
    $data['module'] = $_POST['module'];
    $data['savename'] = $_POST['key'];
    $data['create_time'] = time();
    $data['width'] = $_POST['w'];
    $data['height'] = $_POST['h'];
    $data['type'] = '';
    $data['status'] = 1;
    $data['record_id'] = $data['user_id'] = 0;

    $id = M('Attach')->add($data);

    $this->ajaxReturn(array('id'=>$id,'w'=>$_POST['w'],'h'=>$_POST['h'],'key'=>$_POST['key'],'fsize'=>$_POST['fsize']));
}

3.报错信息:

"{"callback_url":"http://aaabbb.com/public/qiniuUploadCallback","callback_bodyType":"application/x-www-form-urlencoded","callback_body":"key=SchoolWeddingCover%2FFnBXIAKagMtKjkCdQDVvhjq5FqGM.png\u0026w=18\u0026h=30\u0026fname=btn_arrow%403x.png\u0026fsize=1365\u0026filetype=\u0026video=\u0026module=SchoolWeddingCover","token":"","err_code":200,"error":"unexpected response","hash":"FnBXIAKagMtKjkCdQDVvhjq5FqGM","key":"SchoolWeddingCover/FnBXIAKagMtKjkCdQDVvhjq5FqGM.png"}"

4.网上使用解决方法链接:http://blog.csdn.net/guoer997...

回复内容:

1.问题描述:
七牛上传图片,同样的回调函数,在测试服务器上回调报错,报579错误,但是在线上服务器可以上传,而且之前在测试服务器上传是没有问题的,一段时间后有问题了。

2.回到函数:
public function qiniuUploadCallback(){

    $data['key'] = $_POST['filetype'];
    $data['name'] = $_POST['fname'];
    $data['size'] = $_POST['fsize'];
    $data['module'] = $_POST['module'];
    $data['savename'] = $_POST['key'];
    $data['create_time'] = time();
    $data['width'] = $_POST['w'];
    $data['height'] = $_POST['h'];
    $data['type'] = '';
    $data['status'] = 1;
    $data['record_id'] = $data['user_id'] = 0;

    $id = M('Attach')->add($data);

    $this->ajaxReturn(array('id'=>$id,'w'=>$_POST['w'],'h'=>$_POST['h'],'key'=>$_POST['key'],'fsize'=>$_POST['fsize']));
}

3.报错信息:

"{"callback_url":"http://aaabbb.com/public/qiniuUploadCallback","callback_bodyType":"application/x-www-form-urlencoded","callback_body":"key=SchoolWeddingCover%2FFnBXIAKagMtKjkCdQDVvhjq5FqGM.png\u0026w=18\u0026h=30\u0026fname=btn_arrow%403x.png\u0026fsize=1365\u0026filetype=\u0026video=\u0026module=SchoolWeddingCover","token":"","err_code":200,"error":"unexpected response","hash":"FnBXIAKagMtKjkCdQDVvhjq5FqGM","key":"SchoolWeddingCover/FnBXIAKagMtKjkCdQDVvhjq5FqGM.png"}"

4.网上使用解决方法链接:http://blog.csdn.net/guoer997...

回调 579 ,是上传成功但是回调失败了,一般有以下几种情况:
1.网络问题。
2.服务器屏蔽了七牛。
排查时首先确认一下服务器是否对七牛的 IP 进行了屏蔽,确认没有问题的话可以将 reqID 和问题描述发给 support@qiniu.com 让七牛技术支持看一下。

相关标签: php

上一篇:

下一篇: