We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
nishantcyno
9 years agoExplorer | Level 4
File uploading and downloading in business account.
Hi Dropboxer,
I am working on dropbox api in PHP and managing file and folder through running a script from server. All things are working file only issue which I am facing is to uploading a ex...
Greg-DB
Dropbox Community Moderator
9 years agoSince the downloaded file itself is 0 bytes, and the remote file isn't, it appears the issue is with the download operation itself.
To continue debugging this, we should isolate the download call. For example, I just tried this based on your code, and it worked fine for me:
print_r("filename is: $filename \n");
print_r("source is: $source \n");
$ffd = fopen("./files/$filename", "wb");
$metadata = $client->getFile($source, $ffd);
print_r("Received metadata: ");
print_r($metadata);
fclose($ffd);
It successfully downloaded a non-zero-byte file from a business account.
Can you try that in your client's environment and share any error or output you get?
nishantcyno
9 years agoExplorer | Level 4
Hi Greg,
Thanks for your continuous support. You have solved my downloading and uploading issue.
I have one more query regarding dropbox API.
How do I count the no. of directories inside any directory on my dropbox?
Here is my code which is not working right now.
With Regards
Nishant Sharma
- Greg-DB9 years ago
Dropbox Community Moderator
This screenshot also didn't work unfortunately, but if you're still using the API v1 PHP SDK, you can use getDelta (preferably) or getMetadataWithChildren to get the contents of the directory in question, and then count the number of entries where is_dir is true.
For API v2, you would use /files/list_folder[/continue] and count the number of returned entries where the ".tag" is "folder".
- nishantcyno9 years agoExplorer | Level 4
Hi Greg,
Can we have a skype meeting just to resolve issue quickly. I am facing too much issue with Client Business account.
I am facing another issue now with Business Dropbox, on my account script works ok. The difference between my personal dropbox and client one is that Client has 16 TBs of data and too much file but I have only 10-20 MBs.
Now, the situation is I have following files in my dropbox folder e.g Unfiled Documents
1. UR-032085 - PLAN - 1.pdf
2. UR-032085 - Purchase Order - Leigh Lo Nigro.pdf
3. UR-032085 - Quote - Emma Pioch 101 Wattle Avenue.pdf
When I run script : Script has to create a folder and paste above files from its source to that newly created folder. But As I tested. Once I started my script It can't get that folders with API calls. But I reload the script It get the newly created directory. I think synching is not performing well with Business one.
But my dropbox is working ok with simillar situation.
Pls arrange a skype meeting asap.
With Regards
Nishant Sharma
nishantsharma0131@outlook.com
- Greg-DB9 years ago
Dropbox Community Moderator
I can't offer a Skype meeting, but I'm happy to help in the forum here.
Please share the API calls and resulting unexpected responses that are giving you trouble so we can help. - nishantcyno9 years agoExplorer | Level 4
Hi Greg,
The below screenshot is from my client testing end he got stuck inside 0Byte file issue, using your given code, which worked perfectly on my dropbox(testing).
The alternate of above issue is that we can move the files which is already found in that location already by renaming it in catch block. But it also not woring on business but working fine on my dropbox.
I don't know what is going on. Pls fix this and pls understand what is the problem. If you need account info I will happy to share with you.
The error showing is :
ErrorResponse: [403] u"A file with that name already exists at path - Greg-DB9 years ago
Dropbox Community Moderator
It looks like you're running in to two different errors here, so I'll address them separately.
The first one, the 404 in the first screenshot, indicates that there's nothing found at the specified path in the Dropbox account. In the bottom half of that screenshot you're just showing a folder on the local filesystem, not the Dropbox account. I'm not sure what the output above the error is, but it looks like you're trying to delete the file at that path, so perhaps you had just already done so?
Also, you should revoke that access token in the first screenshot now that you've shared it publicly.
The second error indicates that there is already something at the path that you're trying to move the file to.
In both cases, it may help to use getMetadataWithChildren while you debug the issues so that you can better see what the current contents of the account are.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!