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: 

How do I upload a PDF file with Swiftly Dropbox

How do I upload a PDF file with Swiftly Dropbox

bbongrip
Helpful | Level 6

 i can't seem to get a file upload properly with the new v2 Swiftly Dropbox.  Can someone please give me and example?  Im trying to upload a pdf file with images and markup text.  thanks in advance.  

2 Replies 2

Greg-DB
Dropbox Staff

The type of file shouldn't really matter. This works for me:

 

 

let data = try? Data(contentsOf: URL(fileURLWithPath: "/local/path/to/test.pdf"))
if (data != nil) {
    DropboxClientsManager.authorizedClient!.files.upload(path: "/test.pdf", input: data!)
    .response { response, error in
        if let response = response {
            print(response)
        } else if let error = error {
            print(error)
        }
    }
}

If you're still having trouble, please share your code and the error you're getting.

 

 

 

bbongrip
Helpful | Level 6
thanks Greg. this is similar to what i had but its still giving me an error about the directory path. ill post some of my code later on when i get a chance.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    bbongrip Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?