cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Organizing your research is important to easily review and share it. Learn how Kim uses Dropbox to gather and organize her research right 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: 
1
Ask
2
Reply and help

Error In Uploading a file

Re: Error In Uploading a file

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

Re: Error In Uploading a file

Greg-DB
Dropboxer

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.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    kirantara Explorer | Level 3
What do Dropbox user levels mean?
Need more support?