Upload Files with Progress Reporting in Xamarin.Forms and ASP.NET

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • In another video I have shown how to upload a file from Xamarin.Forms to an ASP.NET REST API. From a friend I got the tip (and code!) to redo this sample but now with chunked uploads which enables progress reporting, cancellation and even resuming uploads! All this and more in this new video!
    💝 Join this channel to get access to perks:
    th-cam.com/channels/ral.html...
    🛑 Don't forget to subscribe to my channel for more amazing content: th-cam.com/users/GeraldVerslui...
    🐦 Follow me on Twitter: / jfversluis
    🤝 Join the Discord server: / discord
    🔗 Links
    Sample code repo: github.com/jfversluis/XFUploa...
    File Upload Video: • Uploading Files From a...
    Multiple run configuration: blog.verslu.is/productivity/v...
    Xamarin Forms Repo: github.com/xamarin/Xamarin.Forms
    ⏱ Timestamps
    00:00 - Intro
    00:22 - What To Know About This Video
    01:45 - Inspect End Result
    02:43 - Sample App Outline
    03:35 - Deep-Dive Server Code
    13:49 - Deep-Dive Xamarin.Form Code
    14:03 - What is Refit?
    15:34 - REST Service Communication Client
    16:27 - Client File Upload Code
    21:02 - Running the Sample App
    22:04 - Marker
    23:18 - Outro
    🎥 Video edited with Camtasia (ref): techsmith.z6rjha.net/AJoeD
    🙋‍♂️ Also find my...
    Twitter: / jfversluis
    Blog: blog.verslu.is
    Twitch: / jfversluis
    All the rest: jfversluis.dev
    #XamarinForms #FileUpload #aspnet #chunked #CancelUpload #ProgressUpload #resumeupload #Xamarin
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 51

  • @checox1909
    @checox1909 3 ปีที่แล้ว

    I really like this video, I will use it for a project, thanks Gerald

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Thank you! Let me know how it goes!

  • @robertojrcantos1711
    @robertojrcantos1711 3 ปีที่แล้ว

    This is so amazing Gerald, let’s have also chunks download also and I’m looking forward for it. Thank you

  • @revtane9
    @revtane9 3 ปีที่แล้ว

    AMAZZZZIIINGGGGG as always!

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Haha thank you! :)

  • @wagnernull1096
    @wagnernull1096 ปีที่แล้ว

    Very good.
    I am studyng Xamarin with your lessons.

    • @jfversluis
      @jfversluis  ปีที่แล้ว +1

      That’s amazing, thanks and good luck!

  • @denisgudiel5574
    @denisgudiel5574 3 ปีที่แล้ว

    Amazing!

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Thank you! Cheers!

  • @gizmo3399
    @gizmo3399 3 ปีที่แล้ว +6

    It's good to see my code still being somewhat useful, since i wrote it a while ago.
    But you did an amazing job explaining it and it's capabilities.
    And yes a resumeable upload will definitely be possible with this, although that was indeed not implemented in the demo.
    As for the quitUpload... Yeah probably should be named better. Or even have a separate method to cancel an upload.
    But there are many ways to improve and clean-up this code a bit, but i didn't want to complicate it even more, since this code is definitely not the most straightforward.
    Also checking the file size at the end of an upload can also be improved, since this can still be a corrupt or altered file that has the same file size. Using an SHA1 hash or something similar will probably be safer
    Maybe adding Refit was a bit much?
    It seems that iOS compresses the heck out of the video, seeing how fast it uploaded a 24+ minute video, or you're internal network is just super fast :P
    I totally forgot about the file extension *facepalm* Also it should remove the GUID to restore the orignal filename.
    Thanks so much for making this video!
    Allowing me to contribute to the community in some way, since i'm too shy / lazy to make a video myself, and i don't have a blog or anything like that
    You're awesome!

    • @zizaart1199
      @zizaart1199 3 ปีที่แล้ว +1

      Thank you for sharing!

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      No worries friend! This sample was amazing and thank you for taking the time to create it and show me around in it. You did a great job and I'm glad I was able to make something from it that is now usable for others :)

    • @andrewbeeman84
      @andrewbeeman84 ปีที่แล้ว

      You're awesome bro, GG

  • @damianomeneghetti6858
    @damianomeneghetti6858 3 ปีที่แล้ว +2

    Amazing! Some refactoring to include all code in a service and this will be super useful in future!

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Exactly! Did you also know about Refit yet?

    • @damianomeneghetti6858
      @damianomeneghetti6858 3 ปีที่แล้ว +1

      @@jfversluis yes I use it 😉

    • @gizmo3399
      @gizmo3399 3 ปีที่แล้ว

      Yeah it can definitely be spruced up to be leaner and cleaner. I would also do that if i had to use this code again today

  • @greeksinmars
    @greeksinmars 3 ปีที่แล้ว

    very cool

  • @jbladimir16
    @jbladimir16 3 ปีที่แล้ว

    Fantastic ! Congratulations you are the best ... I hope you could also do for the download.
    Thank you.

  • @VladislavAntonyuk
    @VladislavAntonyuk 3 ปีที่แล้ว +2

    looks like chunk upload takes a bit longer, but we get all benefits like resumable upload and progress bar.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      There is always a trade off somewhere :D

  • @gerardkeown8111
    @gerardkeown8111 2 ปีที่แล้ว

    Hi Gerald, excellent video! Do you have any advice on compressing media prior to upload (especially in Xamarin)? I'm working on video upload at the moment and modern cameras produce quite large files, which is why I need this chunking solution. However, I think I might also need to compress files on android/ios prior to uploading the files to my server...have you encountered the same issue/attempted compression within a Xamarin project before? Thanks.

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว

      Thanks Gerard! Unfortunately I don't have much advice to offer. I don't know of any code or libraries that do this right now. I know its possible on the platforms so you're going to have to write platform code for it if you want to implement it.

    • @gerardkeown8111
      @gerardkeown8111 2 ปีที่แล้ว

      @@jfversluis thanks Gerald. After some further research, we decided to lower the recording video quality using CrossMedia.Current.TakeVideoAsync(options) to record video as opposed to MediaPicker.CaptureVideoAsync(). I looked up methods of compressing the video file post-record, but even zipping the files barely decreases the size of file. It seems compression of multimedia files isn't really worth it. The lower recording quality + this chunking solution will really help though!

  • @25kyro
    @25kyro 2 ปีที่แล้ว

    Amazing! Can you do a video on how to retrieve the files uploaded and organizing it in Folders?

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว +1

      Organize it in folders on the mobile device? What scenario are you thinking of?

    • @25kyro
      @25kyro 2 ปีที่แล้ว

      @@jfversluis yes! Like a user can organize the uploaded files into his own folders so they can break it up how they choose.

  • @stefan91ar
    @stefan91ar 2 ปีที่แล้ว

    Amaizing video man! 👍
    Did you provide the source code?🙃

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว

      In the video description as with all my videos :)

  • @stu007
    @stu007 2 ปีที่แล้ว

    This video is really good, thanks...But I want to know if we can just load the image on the app using a webview.
    Such a way that users that are connected to the internet can actually view the most recent uploads...???

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว +1

      Not entirely sure what you mean. You can definitely load anything in a WebView, but when working with a native app you typically want to avoid that!

    • @stu007
      @stu007 2 ปีที่แล้ว +1

      @@jfversluis thanks for the advice...but I need to know which is the best way to make my app resemble a typical private school app. That is,
      •Students could be able to view school notices, timetables, and more through the app (with internet connection)...
      I dont know what could be the best way to implement the above mentioned.

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว +1

      There is no one best way to do anything. The best way for you is dependent on your existing skills and requirements and what investment you want to make either in learning new things or time/money :)
      If you ask me, loading a web app in an app is never a good idea for various reasons. If that’s what you want, make it a responsive web app and at most make it a progressive web app.

    • @stu007
      @stu007 2 ปีที่แล้ว

      Thanks for the enlightenment Gerald, I will see what I can do...
      Though the idea that comes to my mind right now is simply connecting the local app with a website using a link...
      I think that is the best I can do...
      This will entail that the website will have all the required information/notices...
      🤔

  • @mishashins
    @mishashins 3 ปีที่แล้ว

    Man you are awesome

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Haha thank you 🥰

    • @mishashins
      @mishashins 3 ปีที่แล้ว

      @@jfversluis i think you check my todo list :-)

  • @mo7amedh.m264
    @mo7amedh.m264 3 ปีที่แล้ว

    can you provide a video about refit and explain all thing about it?

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      I will!

    • @mo7amedh.m264
      @mo7amedh.m264 3 ปีที่แล้ว

      @@jfversluis The happiest person now💥❤️

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      I think I might do it this week :)

    • @mo7amedh.m264
      @mo7amedh.m264 3 ปีที่แล้ว

      @@jfversluis Woooow I wait it :)

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Available now for members!

  • @josedonizeteoliveirajunior1744
    @josedonizeteoliveirajunior1744 3 ปีที่แล้ว

    Flashhhh