Uploading image to webservice

2

I'm using alamofire to do post to server, I wanted to know how to send an object that has an img inside it.

I saw the following excerpt to upload the image

  let fileURL = NSBundle.mainBundle().URLForResource("Default", withExtension: "png")
Alamofire.upload(.POST, "https://httpbin.org/post", file: fileURL)

But I still can not figure out how to get fileURL

If someone can inform me if it is possible to send a complete object with a photo or if I have to send it separately and how do I get fileURL

    
asked by anonymous 04.08.2016 / 01:34

1 answer

0

In a project I did, I read the file with pathForResource .

let filePath = NSBundle.mainBundle().pathForResource("Default", ofType:"png")
    
22.08.2016 / 16:31