I want to post a single zip file to dropbox from my apps without redirecting the user to the webpage that allows the user to login to dropbox and authorize my app. I don’t want the user to decide whether or not to allow my application.
I think the model proposed in the documentation can do it but I don’t know how.
here is what i do
local saveData = "hello steeve !"
local path = system.pathForFile( "fish.txt", system.DocumentsDirectory )
local file = io.open( path, "w" )
file:write( saveData )
io.close( file )
file = nil
local bg = display.newImageRect("backgr.png", 960, 480 )
bg.x = display.contentCenterX
bg.y = display.contentCenterY
--------------===========================================-----------------------------------------------
mypatience = display.newText( "One moment please !", display.contentCenterX, 283, native.systemFont, 15 )
mypatience:setFillColor( 0, 0, 0 )
app_key = "xxxxxxxxxx"
app_secret = "xxxxxxxxxxx"
myFile = "fiche.txt"
mySigMethod = "PLAINTEXT"
local function networkListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
mypatience.text = event.response
elseif ( event.phase == "ended" ) then
print ( "Upload complete!" )
mypatience.text = "Upload complete!"
end
end
network.upload(
"https://content.dropboxapi.com/2/files/upload",
"POST", networkListener, myFile, system.DocumentsDirectory, app_key, app_secret, "application/json" )