Uploading a file in a POST Request using Alamofire - Multipart

Поделиться
HTML-код
  • Опубликовано: 19 сен 2024
  • Alamofire Series: Tutorial 5 📝
    In this tutorial we'll see how to upload a file in a POST Method using Alamofire Library with Multipart file upload.
    This tutorial is in continuation of the previous tutorial (Tutorial 4) • Building Form Data and... . It is highly recommended to watch that tutorial to be at pace with this tutorial.
    This tutorial is one of many tutorials in the series, in which we will be exploring the Alamofire Library and how it can be used in your project in Swift.
    So make sure you have subscribed 👆to our channel and you have hit the notification button 🔔
    🔗Tutorial 1: How to send a GET Request using Alamofire Library • How to send a GET Requ...
    🔗Tutorial 2: How to send a GET Request with URL Parameters using Alamofire Library • How to send a GET Requ...
    🔗Tutorial 3: How to send a POST Request using Alamofire Library • How to send a POST Req...
    🔗Tutorial 4: How to send a POST Request using Alamofire Library • Building Form Data and...
    Github Link: github.com/Ala...
    Apple UTI Documentation: developer.appl...
    📌Recap of the previous tutorial at 00:39
    📌Returning a MIME Type of the File from 03:26
    📌Setting a POST Request to Alamofire with Multipart Form Data at 08:24
    📌How to get the progress of the Upload Request at 17:50
    📌Get the Status from 18:40
    📌Size of the Payload from 18:40
    📌Response time of the Payload from 18:40
    We upload new videos every week!
    Please reach out to me on the comments section if you have any doubts on this topic. Also, please Like & Subscribe the Channel and help us being part of your journey to learn Swift. Cheers until the next video!
    #Alamofire #FormBody #POST #Swift

Комментарии • 11

  • @giuseppe99049
    @giuseppe99049 2 года назад

    Thanks for the video, it helped me a lot. Easily explained. I suggest adding an image compressor, something like
    let imgData = image.jpegData(compressionQuality: 0.2)!
    where "image" is your UIImage :)

  • @Nibbbbbbbba
    @Nibbbbbbbba 3 года назад +2

    Great video, If I wanted to upload both a string file and an image to the web service would I just have to add another variable for it like with the dData. And Can I use this format to upload text field input and images selected by the user? Thanks!

    • @RDLabswithRohant
      @RDLabswithRohant  3 года назад

      Hello dear, thats right. It will be an additional parameter to pass.

    • @Nibbbbbbbba
      @Nibbbbbbbba 3 года назад

      @@RDLabswithRohant Yeah, I got it to work myself but I think the image upload was very sloppy, but hey it works. Lol

  • @romanalejandroromancanizal1639
    @romanalejandroromancanizal1639 3 года назад +1

    Very well explained ! I have a question, when you transform "oimage" to data with .pngData(), It shouldn't be a function for jpg ? like .jpgData() or something like that ? because the image extension is jpg. But I see that it worked anyway

    • @RDLabswithRohant
      @RDLabswithRohant  3 года назад +1

      Hello Roman, thank you for reaching out to us.
      Yes indeed, you may use the jpgdata() as well. pngdata() will also work likewise.

  • @srikanthgali9615
    @srikanthgali9615 2 года назад

    How can we pass "Int" values in params, in the above example all all params are of string
    thanks in advnc

  • @RahulPatel-ir7ho
    @RahulPatel-ir7ho 3 года назад +2

    font hard to visible , use bigger font

    • @RDLabswithRohant
      @RDLabswithRohant  3 года назад +1

      Thats right. Those were early days with my Channel. Have bumped up the font in the later tutorials.

  • @AzkaKusuma
    @AzkaKusuma 3 года назад +1

    Can i get the Source Code file? Thank you!

    • @RDLabswithRohant
      @RDLabswithRohant  3 года назад

      Hello Azka, Thank you for your support. I am afraid, I usually delete the source code after a month after the video is made.