I was using Upload v2 API in PHP by curl, but the file limit is around 300MB, when i try to upload a larger file than that, it fails.
Reading forums, docs, i found a useful thing. Use Sessions Upload.
But im stuck in this method because i cant found documentation ou samples for using that.
On my function of upload_session start i pass my token, and the file name i want to upload, and it returns the session id correctly. Now i need make the upload sessions append right?
Below is my code to use append, i make some print to show filesize and the response, but my response is printing NULL all the time, im stuck in this a few days and cant make it goes, someone can help me?
Yes, as you found, since the /2/files/upload endpoint only officially supports uploading files up to 150 MB in size, you should use "upload sessions" to upload larger files. You can find the documentation for the upload session endpoints here:
We don't offer an official PHP SDK or PHP code samples, but the documentation there includes curl examples you can translate for your language and HTTP client. There's also a Java code sample using upload sessions here. That's written for the Java SDK, but the logic should still be useful as an example.
Anyway, you're correct that after you "start" the upload session, the next step is to "append" more data to it. Note that the /2/files/upload_session/append_v2 endpoint doesn't actually have a return value. That is, if the call succeeds, it doesn't return any other information.
You should first check the returned status code (which appears to be '$http_code' in your code.) If it responds with a 200 status code, it means that the operation succeeded. (It would respond with a non-200 status code, optionally with a more specific error in the response body, depending on the type of failure, if it failed.)
Yes, the upload session endpoints allow you to upload a large file by sending it in multiple pieces. (Each piece can be up to 150 MB in size, but something smaller, such as 8 MB, is recommended.) You should send the pieces in order, and you can optionally send them to any of the three endpoints. That is, you can include the first piece of data with the start request, but you are not required to. You can make as many additional calls to the append endpoint as is necessary to upload the entire file. I recommend checking this example to see the flow.
Anyway, if you're getting a 200 status code, that means that the call succeeded and whatever data you sent was appended to the upload session. (I don't actually see where you're setting the data in your code though. It looks like you're just sending an empty string via 'CURLOPT_POSTFIELDS', so you'll need to update that to send the chunk of the file.)
Are you referring to how you read off just a piece, i.e., a "chunk", of the file to upload at a time?
That would depend on your platform/programming language and isn't really about the Dropbox API itself, so I'm afraid I can't offer much guidance on that. I recommend referring to the documentation for platform/programming language. (For instance, for PHP, it looks like stream_get_contents might be useful.) Otherwise, a more general programming forum or something specific to PHP, may be helpful
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?