Think/Upload/Driver/Qiniu/QiniuStorage.php
public function upload($config, $file)
    {
        $uploadToken = $this->UploadToken($this->ak, $this->sk, $config);

        $url = "{$this->QINIU_UP_HOST}";
        $mimeBoundary = md5(microtime());
        $header = ['Content-Type' => 'multipart/form-data;boundary='.$mimeBoundary];
        $data = [];

        $fields = [
            'token' => $uploadToken,
            'key'   => $config['saveName'] ?: $file['fileName'],
        ];

        if (is_array($config['custom_fields']) && $config['custom_fields'] !== []) {
            $fields = array_merge($fields, $config['custom_fields']);
        }

        foreach ($fields as $name => $val) {
            array_push($data, '--'.$mimeBoundary);
            array_push($data, "Content-Disposition: form-data; name=\"$name\"");
            array_push($data, '');
            array_push($data, $val);
        }

        //文件
        array_push($data, '--'.$mimeBoundary);
        $name = $file['name'];
        $fileName = $file['fileName'];
        $fileBody = $file['fileBody'];
        $fileName = static::Qiniu_escapeQuotes($fileName);
        array_push($data, "Content-Disposition: form-data; name=\"$name\"; filename=\"$fileName\"");
        array_push($data, 'Content-Type: application/octet-stream');
        array_push($data, '');
        array_push($data, $fileBody);

        array_push($data, '--'.$mimeBoundary.'--');
        array_push($data, '');

        $body = implode("\r\n", $data);

        return $this->request($url, 'POST', $header, $body);
    }
public function upload($config, $file)
    {
        $uploadToken = $this->UploadToken($this->ak, $this->sk, $config);

        $url = "{$this->QINIU_UP_HOST}";
        $mimeBoundary = md5(microtime());
        $header = ['Content-Type' => 'multipart/form-data;boundary='.$mimeBoundary];
        $data = [];

        $fields = [
            'token' => $uploadToken,
            'key'   => $config['saveName'] ?: $file['fileName'],
        ];

        if (is_array($config['custom_fields']) && $config['custom_fields'] !== []) {
            $fields = array_merge($fields, $config['custom_fields']);
        }

        foreach ($fields as $name => $val) {
            array_push($data, '--'.$mimeBoundary);
            array_push($data, "Content-Disposition: form-data; name=\"$name\"");
            array_push($data, '');
            array_push($data, $val);
        }

        //文件
        array_push($data, '--'.$mimeBoundary);
        $name = $file['name'];
        $fileName = $file['fileName'];
        $fileBody = $file['fileBody'];
        $fileName = static::Qiniu_escapeQuotes($fileName);
        array_push($data, "Content-Disposition: form-data; name=\"$name\"; filename=\"$fileName\"");
        array_push($data, 'Content-Type: application/octet-stream');
        array_push($data, '');
        array_push($data, $fileBody);

        array_push($data, '--'.$mimeBoundary.'--');
        array_push($data, '');

        $body = implode("\r\n", $data);

        return $this->request($url, 'POST', $header, $body);
    }
上传文件

@param $config
@param $file

@return bool