七牛文件上传 报错579(status)
twocode

    七牛文件上传,报错579(status)

Request URL:http://up-z1.qiniu.com/

Request Method:POST

Status Code:579 status code 579

    源代码

$policy = array(
            'callbackUrl' => 'http://pekingpiao.com/callback.php',
            'callbackBody' => '{"fname":"$(fname)", "fkey":"$(key)", "desc":"$(x:desc)", "uid":' . $uid . '}'
        );

$qiniu = new Auth(self::$ak, self::$sk);
$token = $qiniu->uploadToken(self::$bucket, null, 3600, $policy);

因为文件确实上传成功,说明这以上都没有错,而是错在了callback,php 中没有返回给七牛任何值,需要添加代码:

echo json_encode(['success'=>true]);

再次执行程序,正常执行

General:
	Request URL:http://up-z1.qiniu.com/
	Request Method:POST
	Status Code:200 OK
Response Headers view source
	Access-Control-Allow-Headers:X-File-Name, X-File-Type, X-File-Size
	Access-Control-Allow-Methods:OPTIONS, HEAD, POST
	Access-Control-Allow-Origin:*
	Access-Control-Expose-Headers:X-Log, X-Reqid
	Access-Control-Max-Age:2592000
	Cache-Control:no-store, no-cache, must-revalidate
	Connection:keep-alive
	Content-Length:16
	Content-Type:application/json
	Date:Thu, 23 Mar 2017 03:32:13 GMT
	Pragma:no-cache
	Server:nginx
	X-Content-Type-Options:nosniff
	X-Log:body;s.ph;s.put.tw;s.put.tr:3;s.put.tw;s.put.tr:6;s.ph;s.put.tw;s.put.tr:5;s.ph;PFDS:6;PFDS:7;PFDS:9;rs8_1.sel;rwro.ins/same entry;rs8_1.sel;rwro.get;MQ;RS.not:;RS:1;rs.put:1;rs-upload.putFile:12;QINIUPROXY:4750;UP.CB:4752;UP:4767;UP:4959
	X-Reqid:5XIAAM8mmdBRZa4U
	X-Reqid:5XIAAM8mmdBRZa4U
Request Headers view source
	Accept:application/json, text/javascript, */*; q=0.01
	Accept-Encoding:gzip, deflate
	Accept-Language:zh-CN,zh;q=0.8
	Connection:keep-alive
	Content-Length:195827
	Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryLFtkwAYGXBCheBtb
	Host:up-z1.qiniu.com
	Origin:http://pekingpiao.com
	Referer:http://pekingpiao.com/qiniu/index.php
	User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Request Payload
	------WebKitFormBoundaryLFtCheBtb
	Content-Disposition: form-data; name="token"

	Cbew4o1NGYmwLYz5wE18SzV3pcX:e3jfn6TOtaiiOv04GRzbiwEYbRw=:eyJjsYmFja1VybCI6Imh0dHA6XC9cL3Bla2luZ3BpYW8uY29tXC91cGxvYWRmaWxlXC9xaW5pdS5waHAiLCJjYWxsYmFja0JvZHkiOiJ7XCJmbmFtZVwiOlwiJChmbmFtZSlcIiwgXCJma2V5XCI6XCIkKGtleSlcIiwgXCJkZXNjXCI6XCIkKHg6ZGVzYylcIiwgXCJ1aWRcIjpzZWxmfSIsInNjb3BlIjoicGVraW5ncGlhbyIsImRlYWRsaW5lIjoxNDkwMjQzMjc3LCJkZXRlY3RNaW1lIjoxLCJ1cEhvc3RzIjpbImh0dHA6XC9cL3VwLXoxLnFpbml1LmNvbSIsImh0dHA6XC9cL3VwbG9hZC16MS5xaW5pdS5jb20iLCItSCB1cC16MS5xaW5pdS5jb20gaHR0cDpcL1wvMTA2LjM4LjIyNy4yNyJdfQ==
	------WebKitFormBoundaryLFtkwheBtb
	Content-Disposition: form-data; name="file"; filename="920cfb_05807d6740fa0b34250588cc.jpg"
	Content-Type: image/jpeg


	------WebKitFormBoyLFtkwAYGXBCheBtb--


网友评论已关闭