This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Astrophylite's profile picture

Uploading to Dropbox through computers/turtles

Started by Astrophylite, 22 July 2015 - 03:55 PM
Astrophylite #1
Posted 22 July 2015 - 05:55 PM
Hi,

I have already made a program that is able to download/run programs from Dropbox, but I am now wondering how I then upload them to Dropbox, much like the Pastebin app.

Any help will be appreciated,
ZiR
KingofGamesYami #2
Posted 22 July 2015 - 06:01 PM
Perhaps the dropbox api would help you. I've linked to the PUT section, which should allow you to upload files.
Astrophylite #3
Posted 22 July 2015 - 06:43 PM
Okay, I am starting to code it now but the part I don't get is the 'request body'…
Any explanation / sample code would be appreciated..

ZiR
KingofGamesYami #4
Posted 22 July 2015 - 06:50 PM
I'm not familiar with using the http api beyond interacting with github or pastebin.

However, I think it refers to the postData parameter from http.post.
MKlegoman357 #5
Posted 22 July 2015 - 06:51 PM
It's the second parameter for http.post. It simply should be a string containing the file contents. You'll also have to set the 'content-length' header to the length of the file contents.
KingofGamesYami #6
Posted 22 July 2015 - 06:52 PM
You'll also have to set the 'content-length' header to the length of the file contents.

Actually, I believe that's optional.

Nevermind I'm just stupid
Edited on 22 July 2015 - 04:53 PM
Astrophylite #7
Posted 22 July 2015 - 07:02 PM
Okay, I've scrapped the idea of posting to Dropbox. I will just download the files on startup so that then I will remember to edit them through Dropbox.
But, thanks for your help nonetheless.

ZiR