how to upload a file to dropbox

128 views
Skip to first unread message

Vikram Chhajer

unread,
Nov 12, 2019, 1:20:18 PM11/12/19
to Harbour Users
Hello Everyone

I am Tring to uplaod Some Files to dropbox but could not acivate the command  ,How ?

function main()
	local oHTTP,cJSON,url
	setmode(25,80)
	cJSON = {"path": "hb_cwd()+"report.txt","mode": "add","autorename": true,"mute": false,"strict_conflict": false}
	url := "https://content.dropboxapi.com/2/files/upload \"
	oHTTP := CREATEOBJECT('Msxml2.ServerXMLHTTP.6.0')
	oHTTP:OPEN("POST",  url , .F.)
	oHTTP:setRequestHeader("Content-Type", "application/octet-stream")
	oHTTP:SEND(cJSON)
		IF oHTTP:status != 200
		? "Error"
	ELSE
		 ? oHTTP:responseText
         hb_memowrit("response.txt",oHTTP:responseText)
     	 ENDIF
		return
		
		
		
		
	//* 	url -X POST https://content.dropboxapi.com/2/files/upload \
    --header "Authorization: Bearer " \
    --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @local_file.txt //*
	
//*	PARAMETERS
{
    "path": "/Homework/math/Matrices.txt",
    "mode": "add",
    "autorename": true,
    "mute": false,
    "strict_conflict": false
}//* 

Thanks 
Vikram
Reply all
Reply to author
Forward
0 new messages