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.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Re: Error In Uploading a file

Error In Uploading a file

kirantara
Explorer | Level 3

Hello Experts 

I am New To Dropbox Api And Today i was trying to uplaod a file from api but got error .  

 

Unknown API function: "files/upload \\eHiSS5jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

i am using Http api  and my code is 

 

function main()
local oHTTP,cJSON,url
setmode(25,80)

ctoken := "<REDACTED>"

url := "https://content.dropboxapi.com/2/files/upload \" + ctoken
cJSON := '{"c:\tmp\pdf\CKF1907319.pdf","mode": "add","autorename": true,"mute": false,"strict_conflict": false,}'
URL
? cjson
wt = inkey(0)

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
? oHTTP:responseText
hb_memowrit("response.txt",oHTTP:responseText)
? "Error"
ELSE
? oHTTP:responseText
hb_memowrit("response.txt",oHTTP:responseText)
ENDIF
wt = inkey(0)
return  

 

Please me to solve this issue

 

Vikram

11 Replies 11

kirantara
Explorer | Level 3

Sir 

Then Please i am sorry to say that i am not able to upload the pdf file to dropbox abc FOlder  please me help me to do this make changes in code which is attached here

File to Upload   Email.pdf  

upload to drop in folder abc folder with file name email.pdf  

where to mention and how to arttach in code  please change the code where necessary


**----------------------------
function main()
**----------------------------
Local oHttp, cJSON, urlUpload

setmode(25,80)

cToken := "eHiSS5jXq0AAAAAAAAAAduAlRf3zXxxxxxxxxxxxxxxxxxxxx"

urlUpload := "https://content.dropboxapi.com/2/files/upload"

// cJSON := '{c:\tmp\pdf\CKF1907319.pdf, "mode": "add","autorename": true,"mute": false,"strict_conflict": false,}'
cJson := hb_memoread("demo.hbp")

// cPath := "/HomeWork/demo.txt"
cPath := "/PMCSURAT/demo.txt"

oHttp := CREATEOBJECT('Msxml2.ServerXMLHTTP.6.0')
oHttp:OPEN("POST", urlUpload , .F.)
oHttp:setRequestHeader( "Authorization", "Bearer " + cToken )
oHttp:setRequestHeader( "Dropbox-API-Arg", '{ "path": "' + cPath + '", "mode" : "overwrite" }' )
oHttp:setRequestHeader( "Content-type", "application/octet-stream" )
oHttp:SEND(cJSON)
IF oHttp:status != 200
? oHttp:responseText
hb_memowrit("response.txt",oHttp:responseText)
? "Error"
ELSE
? oHttp:responseText
hb_memowrit("response.txt",oHttp:responseText)
ENDIF

?
wait
// wt = inkey(0)


Return

 

Thank you & reagards

Vikram

Greg-DB
Dropbox Staff

I'm afraid I can't write the necessary code for you, so I recommend referring to the documentation and my earlier replies for information on the expected request format for the Dropbox API so you can debug and update your code to consume the API properly. If you discover any bugs with the Dropbox API please let us know of course.

Need more support?