Sending files - Python on the web - Learning Flask Series Pt. 14

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

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

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

    with flask version 2.0 instead of filename you use path
    send_from_directory(app.config[... ] , path=image_file_name ....

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

    this flask tutoril is best then the all tutoril on the youtube

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

    I’ve been going through each episode one at a time, using your website and going back to each many times over. Thank you! 🙏🙏🙏

  • @joecandoit5341
    @joecandoit5341 5 ปีที่แล้ว +4

    You sir helped me solve my confusion on this flask function. Thank you from a Python newbie! No more school boy errors for me.

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

    Wrapped this into a HTML page with a file list so the user can click on the filename to download it. Awesome.

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

    what a king.....btw for anyone newcomers instead of filename parameter for the send_from_directory...its now path

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

      Did you have any issues with the CSV part? It's pretty much the same as img but swap out IMAGES with CSV and image_name with filename but dang if I can get it to behave. Nothing but 404 comes up.

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

      Stupid bloody Windows. /LOL For my test CSV file I had renamed a .txt file to .csv and Windows kept the .txt so it became 001.csv.txt It helps to call the files by their real name or at least name them right in the first place. /DOH! /LOL.

  • @pronoygomes2505
    @pronoygomes2505 4 ปีที่แล้ว

    Very helpful tutorials on Flask. Thank you

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

    I really enjoy your series Julian, keep up the good work. I think it would be better to connect a button to the path of the files to get them downloaded. A lot of not so tech guys will be frustrated to type the name of the file they want to download.

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

      That's exactly what I'm trying to do (trigger a file download when the user clicks a button) but not having much luck so far. Any resources you could point me to for getting this working?

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

      Download
      This will make it look like a button, Then you use the url_for to direct the path to the download function.

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

      @@bismarkosei9656 Thanks

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

    Need to add a sticky somewhere about filename= is now path=

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

    For those who get a 404 error and are using Windows, you have to start your working directory with "C:" and remove the leading slash. So in this example it would be app.config["CLIENT_IMAGES"] = C:/wsl/projects/pythonise... etc.

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

    LEGEND, for the ones who have this error "send_from_directory() missing 1 required positional argument: 'path'", replace filename for path in "send_from_directory(app.config['CLIENT_IMAGES'], path=image_name, as_attachment=True)".

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

      If i had read this comment before i Would've save about 25 hours of my life trying to find why my code didn't work

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

      @@juanzaragoza6129 +1 🙂 Wonder why it worked in the video for him using filename instead of path?

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

      @@jasond580 flask version probably

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

      @@yomajo I see...thanks!

  • @ThilinaWimalapriya
    @ThilinaWimalapriya 5 ปีที่แล้ว

    A very good video. Thanks for the sharing

  • @alidaghighi8937
    @alidaghighi8937 5 ปีที่แล้ว

    Pretty helpful! Thanks and keep up buddy!

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

    Hello, please is there a tip to check the orientation of an odt file before upload ? That is to say I would like to check is the user select landscape mode in a dropdown list and he tries to send the file which is not in landscape, I will return a validation error

  • @HetPatel-tp8rv
    @HetPatel-tp8rv 4 ปีที่แล้ว

    It is very helpful video

  • @linanyaooo6008
    @linanyaooo6008 5 ปีที่แล้ว

    GOOD JOB BRO, RESPECT

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

    Hi,
    Can you make video on send files to render inside html like pdf load inside html

    • @mkt7652
      @mkt7652 4 ปีที่แล้ว

      did you find the solution ..?? if yes please let me know

  • @marc-alexandrepaquet7696
    @marc-alexandrepaquet7696 5 ปีที่แล้ว +1

    Looks like the except part is never triggered, even if you have an error. The send_from_directory seems to handle it.

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

    I want to send a pdf file from one user to another over my website how can I achieve this?

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

    thanks!

  • @AutomationWithSholz
    @AutomationWithSholz 5 ปีที่แล้ว

    isn't it possible to use {{url_for("file")}} here?

  • @nikhilmugganawar
    @nikhilmugganawar 4 ปีที่แล้ว

    How to take two excel files from UI, process them and send back a excel with multiple sheets

  • @varunmanchanda3972
    @varunmanchanda3972 5 ปีที่แล้ว

    Sir, it is showing me 404 Not Found, what to do?!

  • @oneclick5583
    @oneclick5583 4 ปีที่แล้ว

    spr bro mass.....And you looking so handsome bro