Announcements
Do you have an idea for Dropbox Paper? Share it with us here!

Upload File not working through API

Helpful | Level 5

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

1 Accepted solution

Accepted Solutions

Re: Upload File not working through API

Helpful | 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]

View solution in original post

Reply
Loading...
1 Reply

Re: Upload File not working through API

Helpful | 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]

View solution in original post

Reply
Loading...
Developer & API Discussions

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about Developer & API Discussions.

Or, search our Help Center for even more.

Who's talking
Top contributors to this post