cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

upload image using apiv2 in iOS idk using objective c

Explorer | Level 3

How i can upload image usign objective c. I am using APIV2.

And i implemted it which display me an error.  Test 1 root folder here. I want to image uplaod in this folder

 

 

NSData *fileData = [@"water.jpg" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
    
    [[[client.filesRoutes uploadData:@"/Test1/" inputData:fileData]
      setResponseBlock:^(DBFILESFileMetadata *result, DBFILESUploadError *routeError, DBRequestError *networkError) {
          if (result)
          {
              NSLog(@"%@\n", result);
          } else
          {
              NSLog(@"%@\n%@\n", routeError, networkError);
          }
      }] setProgressBlock:^(int64_t bytesUploaded, int64_t totalBytesUploaded, int64_t totalBytesExpectedToUploaded) {
          NSLog(@"\n%lld\n%lld\n%lld\n", bytesUploaded, totalBytesUploaded, totalBytesExpectedToUploaded);
      }];

 

ERROR----

 

DropboxBadInputError[{
    ErrorContent = "Error in call to API function \"files/upload\": path: invalid path: paths must not have a trailing \"/\"";
    RequestId = 9576332b860df94c12bcc13a28a6877a;
    StatusCode = 400;
    UserMessage = nil;
}];

 

1 Accepted Solution

Accepted Solutions

Re: upload image using apiv2 in iOS idk using objective c

Dropboxer
Dropboxer
This error message is expected in this case, as the file path you supply can't end with a "/", as yours does (@"/Test1/"). When uploading, you should supply the full path, including file name. You probably meant to supply something like @"/Test1/water.jpg" instead.

View solution in original post

1 Reply 1

Re: upload image using apiv2 in iOS idk using objective c

Dropboxer
Dropboxer
This error message is expected in this case, as the file path you supply can't end with a "/", as yours does (@"/Test1/"). When uploading, you should supply the full path, including file name. You probably meant to supply something like @"/Test1/water.jpg" instead.

View solution in original post

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Polls
Have you been keeping up good habits while working from home?
We've created a working from home cheat sheet to help keep up on those habits, check it out here.
Need more support?