cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload File not working through API

Upload File not working through API

jordonshaw
Helpful | Level 5
Go to solution

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

jordonshaw
Helpful | Level 5
Go to solution

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

1 Reply 1

jordonshaw
Helpful | Level 5
Go to solution

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]

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    jordonshaw Helpful | Level 5
What do Dropbox user levels mean?