0

I am unable to upload a file (an mp4) to my server. I control the server and use an npm library parse the request. Now, when I use Postman and select a test mp4 to upload to my server, I successfully receive it. Yet when using this function from Alamofire, I receive nothing.

Alamofire.upload(fileURL, to: "http://localhost/video").responseJSON { response in
    debugPrint(response) }

I send back some JSON in the response and successfully receive it in my app. No errors on either side. What am I missing?

Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80

1 Answers1

2

Use MultiFormData to upload the image

Alamofire.upload(
    multipartFormData: { multipartFormData in
        multipartFormData.append(fileUrl, withName: "fileName")
    },
    to: "http://localhost/video").responseJSON { 
    response in
    debugPrint(response) 
})
ferbass
  • 859
  • 5
  • 17