One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
jordonshaw
6 years agoHelpful | Level 5
Upload File not working through API
I have an issue and can't figure out what's going on. If I run this code:
if ( empty( $_FILES['the_upload'] ) ) { ?> <form enctype="multipart/form-data" method="POST" action=""> <p> <label for="file">Upload File</label> <input type="file" name="the_upload"/> </p> <p><input type="submit" name="submit-btn" value="Upload!"></p> </form> <?php } else { $upload_name = $_FILES["the_upload"]["name"]; echo "<pre>"; echo "\n\n<b>Uploading $upload_name:</b>\r\n"; $meta = $dropbox->UploadFile( $_FILES["the_upload"]["tmp_name"], $upload_name ); print_r( $meta ); echo "\r\n done!"; echo "</pre>"; }
I get a form, select my file and click Upload and it uploads the file to my dropbox without issues; however, if I run this code:
$upload_name = 'File_000.jpeg'; echo "<pre>"; echo "\n\n<b>Uploading $upload_name:</b>\r\n"; $meta = $dropbox->UploadFile( '/Users/Shared/test', $upload_name ); print_r( $meta ); echo "\r\n done!"; echo "</pre>";
The file uploads to my dropbox; however, it has 0 bytes and isn't really uploading the file. Any ideas on what could be the issue?
Thanks in advance!
Jordon
Nevermind, I figured this out. I tried deleting this post, but didn't see the option.
[CLOSED BY COMMUNITY'S MODERATORS AS PER USER'S REQUEST]
- jordonshawHelpful | Level 5
Nevermind, I figured this out. I tried deleting this post, but didn't see the option.
[CLOSED BY COMMUNITY'S MODERATORS AS PER USER'S REQUEST]
About Discuss Dropbox Developer & API
Make connections with other developers804 PostsLatest Activity: 3 days ago
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 or Facebook.
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!