Django Media Files - Restricting Uploadable File Types with Validators and python-magic

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ส.ค. 2024

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

  • @SOHAILKHAN-iu8fu
    @SOHAILKHAN-iu8fu ปีที่แล้ว +2

    Wow, this video is incredibly informative and eye-opening! I had no idea about these. Thank you so much for sharing and raising awareness on such an important topic. Keep up the great work!

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

      Thank you - I'm glad that the video was useful!

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

    Never disappointed with you mate. I learnt somethong new thank you Master 🙌🏾

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

      Thanks a lot man, as always!

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

    This library is really magical 👍

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

    Exactly what I needed. Thanks man, you're the best!

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

      Thanks a lot for the support!

  • @user-wb5hj3qn5x
    @user-wb5hj3qn5x 10 หลายเดือนก่อน

    Thanks man ,very very good

    • @bugbytes3923
      @bugbytes3923  10 หลายเดือนก่อน

      Thanks a lot man!

  • @SteveRobinson-n4k
    @SteveRobinson-n4k วันที่ผ่านมา

    Fantastic video! So to be clear on one point: You switched from using an ImageField to a FileField in an earlier video in this series. If I use an ImageField instead, would I get validation functionality out of the box, or do I still have to use "install magic"? I was hoping to use a FileField as you have shown, but I can switch my code up if I am unable to deploy this solution into an Azure production environment.

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

    Thx a lot.
    Small note about unit testing: if you used a generated file for the test you can get a TypeError (expect string but not imagefield file as 10:25 expects a path to the file. I've solved it by changing param to a file for reading bytes.

  • @user-co1bc6iq9r
    @user-co1bc6iq9r ปีที่แล้ว

    Hey man I spent a week thinking on how best to do content validation of a file. This was very helpful, once step closer to completing the goal.

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

      Hey - thanks, glad to hear it was helpful. Thanks for watching! Good luck in your project.

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

    thanks this was useful for me 👍👍

  • @digital-tree
    @digital-tree ปีที่แล้ว +1

    excellent video, congratulations on the didactics

  • @iwswordpress
    @iwswordpress 8 หลายเดือนก่อน

    Excellent! My go to channel for Django :)

    • @bugbytes3923
      @bugbytes3923  8 หลายเดือนก่อน

      Awesome - Thanks a lot for watching!

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

    One more great video, which is not a surprise, thank you! Can you please tell me, considering the options presented, is it enough to use only the 3rd option?

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

      Thank you!
      I would recommend all 3. Even adding the "accept" attribute in HTML can prevent unwanted uploads that will be rejected on your server. Anything to prevent unnecessary load on the server (plus associated costs) is a win!
      By only using the 3rd option, users will find it easier to upload the wrong file types, which the server then processes and rejects - that load can be avoided with the other two methods.

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

      @@bugbytes3923 thank you

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

    thank

  • @hjs9693
    @hjs9693 3 หลายเดือนก่อน

    Thank you for your video.
    im curious why just use 1024 bytes in from_buffer?
    Is this based on something that data or books?

    • @bugbytes3923
      @bugbytes3923  2 หลายเดือนก่อน

      Thank you. No real reason to choose that number, just for demo.

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

    Came back to post another comment, so i have implemented this but when trying to deploy to railway app, the build breaks on this python magic bin library. Any advice?
    Is there another way to do the same thing?

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

      Ah - sorry to hear that. Do you have an error log for this issue?
      I've not used Railway, but might be able to help.

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

    Wowww