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

picture upload via php #256

Open
albertmgh opened this issue Mar 12, 2018 · 0 comments
Open

picture upload via php #256

albertmgh opened this issue Mar 12, 2018 · 0 comments

Comments

@albertmgh
Copy link

Hallo,
i'm trying to upload a photo and read the documentation that describes the two steps flow.
In the first step im getting the code 200 and all necessary data to post the second step.

please tell me how to add the data to the curl request ...

here is my code

public function sendPhotoRequest($filename){
    $this->response = $this->connection->post(self::URL, $this->parameters);
    
    if (function_exists('curl_file_create')) {
        $cFile = curl_file_create($filename, 'image/jpeg');
    } else { // 
        $cFile = '@' . realpath($filename);
    }

    require_once ROOTDIR.'/utils.php';
    $post = objectToArray($this->response->presigned_post->fields);
    $header = array("Content-Type:multipart/form-data");

    $post['file'] = $cFile;

    $this->response = $this->connection->post($this->response->presigned_post->url, $post, $header);

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

No branches or pull requests

1 participant