• Wesley Kappen
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi,

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.setMethod('POST');
		request.setEndpoint('https://api-content.dropbox.com/1/files_put/auto/test123.zip');
		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');
		request.setBodyAsBlob(file.body);
		
		System.debug(request);
		
		Http hp = new Http();
		
		HttpResponse response = hp.send(request);
		if(response != null){
			System.debug(response.getBody());	
		}
Uploading works for very small file sized (1MB). Does anyone have any idea what could be the problem?

Help will be much appreciated. 




Hi,

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.setMethod('POST');
		request.setEndpoint('https://api-content.dropbox.com/1/files_put/auto/test123.zip');
		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');
		request.setBodyAsBlob(file.body);
		
		System.debug(request);
		
		Http hp = new Http();
		
		HttpResponse response = hp.send(request);
		if(response != null){
			System.debug(response.getBody());	
		}
Uploading works for very small file sized (1MB). Does anyone have any idea what could be the problem?

Help will be much appreciated.