Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

добавление произвольного заголовка #13

Open
gluck59 opened this issue Jun 15, 2016 · 1 comment
Open

Comments

@gluck59
Copy link

gluck59 commented Jun 15, 2016

Привет
Я начинающий, ногами не пинать :)
Как добавить заголовок X-Delete-After при putFile? Как ни пробовал, все время на что-нибудь ругается :(

@nagaaruka
Copy link

Мой вариант

public function putFile($localFileName, $remoteFileName = null, $delete_after=0)
{
        if (is_null($remoteFileName))
            $remoteFileName = array_pop(explode(DIRECTORY_SEPARATOR, $localFileName));
        $header=$this->token;
        if($delete_after){
            $header=array_merge($header,array('X-Delete-After: '.(int)$delete_after));
        }
        $info = SCurl::init($this->url . $remoteFileName)
            ->setHeaders($header)
            ->putFile($localFileName)
            ->getInfo();

        if (!in_array($info["http_code"], array(201)))
            return $this->error($info["http_code"], __METHOD__);

        return $info;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants