Skip to content
This repository was archived by the owner on Apr 18, 2019. It is now read-only.
This repository was archived by the owner on Apr 18, 2019. It is now read-only.

Expecting a file upload (Status Code: 400) #67

@Blacx

Description

@Blacx

Dear @benthedesigner ,

I'm having an error when running putFile.php.

The error message that appears is as follows:
Catchable fatal error: Object of class stdClass could not be converted to string in C:\xampp\htdocs\dropbox\new\Dropbox\OAuth\Consumer\Curl.php on line 103

But I tried to change $response['body']->error on \Dropbox\OAuth\Consumer\Curl.php file at line 103 be as follows:
$message = $response['body']->error->file . ' (Status Code: ' . $response['code'] . ')';

And the exception that appears now is "Expecting a file upload".

Here is the putFile.php which I modified:

require_once('bootstrap.php');
try {
    $tmp = tempnam('/tmp', 'dropbox');
    $data = 'This file was uploaded using the Dropbox API!';
    file_put_contents($tmp, $data);    
    $put = $dropbox->putFile($tmp, 'api_upload_test.txt');
    unlink($tmp);   
    var_dump($put); 
} catch (\Dropbox\Exception $e) {
    var_dump($e);
}

Here is the output:
Expecting a file upload

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions