Home >Backend Development >PHP Tutorial >There is an error in the callback for uploading pictures. The same callback function is just changed to a different domain name. The online server is OK, but the test server reports an error and returns 579. What's going on?

There is an error in the callback for uploading pictures. The same callback function is just changed to a different domain name. The online server is OK, but the test server reports an error and returns 579. What's going on?

WBOY
WBOYOriginal
2016-12-01 00:56:471973browse

1. Problem description:
When Qiniu uploads pictures, the same callback function returns an error on the test server and reports a 579 error. However, it can be uploaded to the online server, and there was no problem uploading to the test server before. After a while, there is an error. Problem.

2. Return to the function:
public function qiniuUploadCallback(){

<code>    $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']));
}</code>

3. Error message:

<code>"{"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"}"</code>

4. Online solution link: http://blog.csdn.net/guoer997...

Reply content:

1. Problem description:
When Qiniu uploads pictures, the same callback function returns an error on the test server and reports a 579 error. However, it can be uploaded to the online server, and there was no problem uploading to the test server before. After a while, there is an error. Problem.

2. Return to the function:
public function qiniuUploadCallback(){

<code>    $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']));
}</code>

3. Error message:

<code>"{"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"}"</code>

4. Online solution link: http://blog.csdn.net/guoer997...

Callback 579 means the upload was successful but the callback failed. Generally, there are the following situations:
1. Network problem.
2. The server has blocked Qiniu.
When troubleshooting, first confirm whether the server has blocked Qiniu’s IP. If there is no problem, you can send the reqID and problem description to support@qiniu.com and let Qiniu technical support take a look.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn