5 Replies - 2079 Views - Last Post: 29 March 2014 - 07:26 PM Rate Topic: -----

#1 StealthRT   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 95
  • Joined: 29-September 08

Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 03:07 PM

I am currently using the sample.php page provided with the code here.

Now it does create the access token just fine.

It also shows my account info as it should be.

It finds all the file directory's in the "files array" part.

It can upload a test image just fine to dropbox.

It can get all the meta data for current images in my dropbox folder.

However, I can not seem to download the images from dropbox!

The error i get once it gets to this code:
echo "\r\n\r\n<b>Downloading $file->path:</b>\r\n";
print_r($dropbox->DownloadFile($file, $test_file));



Is this below:
( ! ) Fatal error: Uncaught exception 'DropboxException' with message ' in C:\wamp\www\test\DropboxClient.php on line 634 

( ! ) DropboxException: Could not retrieve meta data from header data: Array
(
    [0] => HTTP/1.1 404 Not Found
    [1] => Server: nginx
    [2] => Date: Sat, 29 Mar 2014 18:07:54 GMT
    [3] => Content-Type: application/json
    [4] => Transfer-Encoding: chunked
    [5] => Connection: keep-alive
    [6] => 
)
 in C:\wamp\www\test\DropboxClient.php on line 634 

Call Stack 

# Time Memory Function Location 

1 0.0016 156816 {main}(  ) ..\sample.php:0 

2 1.0901 343472 DropboxClient->DownloadFile(  ) ..\sample.php:80 

3 1.4278 344872 DropboxClient::getMetaFromHeaders(  ) ..\DropboxClient.php:223

I'm not sure where i am needing to check out (either in the code or on the wamp side) in order to correct this issue above?

Any help would be great!

Is This A Good Question/Topic? 0
  • +

Replies To: Dropbox API using PHP (via dropPHP) download error

#2 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,569
  • Joined: 12-December 12

Re: Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 04:33 PM

For reference: DropPHP

I don't use this myself but based on this:

Quote

[0] => HTTP/1.1 404 Not Found

I would double, and triple!, -check $file and $test_file. The docs confirm that the destination directory has to exist:

Quote

Downloads a file to the specified location on the webserver. The destionation directory has to exist.

So it seems it should be a directory, rather than directory and filename. Also check your write permissions to this location.

And I would test it live rather than via WAMP.

This post has been edited by andrewsw: 29 March 2014 - 04:36 PM

Was This Post Helpful? 0
  • +
  • -

#3 StealthRT   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 95
  • Joined: 29-September 08

Re: Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 05:02 PM

I'm thinking it may be because its trying to pass just a directory at first?
Meta data of /Camera Uploads:
stdClass Object
(
    [hash] => 784FeG58ht5j7yjui86fj7GD56y
    [revision] => 22
    [rev] => 161f5f4043
    [thumb_exists] => 
    [bytes] => 0
    [modified] => Sun, 23 Mar 2014 18:05:38 +0000
    [path] => /Camera Uploads
    [is_dir] => 1
    [icon] => folder_photos
    [root] => dropbox
    [contents] => Array
        (
            [0] => stdClass Object
                (
                    [revision] => 47
                    [rev] => 345hj76m89
                    [thumb_exists] => 1
                    [bytes] => 3212196
                    [modified] => Sun, 23 Mar 2014 18:07:05 +0000
                    [client_mtime] => Wed, 05 Feb 2014 19:10:14 +0000
                    [path] => /Camera Uploads/2014-02-05 14.10.13.jpg
                    [is_dir] => 
                    [icon] => page_white_picture
                    [root] => dropbox
                    [mime_type] => image/jpeg
                    [size] => 3.1 MB
                )

            [1] => stdClass Object
                (
                  etc etc...


This post has been edited by andrewsw: 29 March 2014 - 05:12 PM
Reason for edit:: Removed previous quote

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,569
  • Joined: 12-December 12

Re: Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 05:15 PM

I'm not sure what that data is telling us(?).

Personally, though, I don't like the filename: "2014-02-05 14.10.13.jpg"

Try it with some "test.jpg".

BTW There is no need to quote a large previous post, there is a Reply button further down the page.
Was This Post Helpful? 0
  • +
  • -

#5 StealthRT   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 95
  • Joined: 29-September 08

Re: Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 07:12 PM

Thanks for the help, andrew!

This post has been edited by StealthRT: 29 March 2014 - 07:22 PM

Was This Post Helpful? 0
  • +
  • -

#6 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,569
  • Joined: 12-December 12

Re: Dropbox API using PHP (via dropPHP) download error

Posted 29 March 2014 - 07:26 PM

No worries. If, I assume, you've solved it then confirming your solution could be useful to someone else in the future ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1