Acquiring absolute image file path using iOS Swift

Does anyone know how to acquire the absolute path from an image using
iOS Swift? I am trying to send the file path in a HTTP post request. I
have tried the code below but it takes too long to process. I am trying
to send the file path of an image to a PostgreSQL database. Any tips
are greatly appreciated. Thank you!

var paths: NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
   var documentDirectory: NSString = paths.objectAtIndex(0) as NSString
   var localFilePath: NSString = documentDirectory.stringByAppendingPathComponent("image.png")
   var data: NSData = UIImagePNGRepresentation(image)
   data.writeToFile(localFilePath, atomically: true)

  • Connect iPhone App to PostgreSQL Using Libpq
  • AFNetworking- post request- add simple text to body
  • How to send multiple parameterts to PHP server in HTTP post
  • ios Upload Image and Text using HTTP POST
  • Sending an HTTP POST request on iOS
  • Posting JSON data using AFNetworking 2.0
  • Solutions Collect From Internet About “Acquiring absolute image file path using iOS Swift”

    let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first as NSURL
    if let fileAbsoluteUrl = documentsUrl.URLByAppendingPathComponent( "image.png").absoluteURL {