How to Upload pdf file located in document directory to server.
Appreciate for help
How to Upload pdf file located in document directory to server.
Appreciate for help
SWIFT 2.0 : Use below code to convert pdf file to NSData. And use the POST service to upload the data to server.
let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
var filePath = documentDirectory.stringByAppendingString("/")
filePath = filePath.stringByAppendingString("final.pdf")
let pdfData = NSData(contentsOfFile: filePath)
Here, "filePath" is the path of the pdf file in document directory with name "final.pdf".