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: 

upload image using apiv2 in iOS idk using objective c

upload image using apiv2 in iOS idk using objective c

bliss
Explorer | Level 3
Go to solution

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

Greg-DB
Dropbox Staff
Go to solution
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

Greg-DB
Dropbox Staff
Go to solution
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.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?