+ Start a Discussion
Wesley KappenWesley Kappen 

Upload a file to Dropbox using HttpRequest (error)


I am encouring some issues and errors whilst uploading a file to dropbox from Salesforce. The integration is nearly compelted and getting, deleting, downloading files is working as it should. Now the uploading part is where I am getting errors.

We need large amount of file storage so Dropbox was our best option. Because we have a complex application we need to create a custom integration and therefor cannot use the standard Dropbox appexchange application.

When a user selects a file to upload it will not get saved on the Salesforce server. Instead we create a Attachment object and do not save it. And use the following code to upload a file to dropbpx:

HttpRequest request = new HttpRequest();
		request.setHeader('Authorization', 'OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="XXXXX", oauth_token="XXXXX, oauth_signature="XXXXX&XXXXXXX"');
		request.setHeader('Content-Length', String.valueOf(file.body.size()));
		request.setHeader('Content-Type', 'application/octet-stream');
		Http hp = new Http();
		HttpResponse response = hp.send(request);
		if(response != null){
Uploading works for very small file sized (1MB). Does anyone have any idea what could be the problem?

Help will be much appreciated. 

Can you post the specific error message?
Dejan CvetkoskiDejan Cvetkoski
Tell me how, if you finished with this.
Wesley KappenWesley Kappen
We've stopped pursuing to use Dropbox for this integration. But I did manage to solve this issue using a remote webserver. When pressing a link a popup opens which is a client on a different server. (Enterprise Service Bus). We've moved to Amazon S3 because the solution I just mentioned is very complicated and not very efficient! *Met vriendelijke groet,* *Wesley Kappen* *e: wkappen@maxedy.com * *t: **+31 (0)20 21 81 732 * *a: Johan Huizingalaan 763A 1066VH Amsterdam* * *
Naveen KNNaveen KN
A detailed post on integrating Salesforce with Dropbox


Naveen K N