As somebody who is learning programming from youtube, I can say this is one of the best tutorials I've ever seen. The explanation is clear, the code is clean and cover all the basic elements to complete the task. I definitely will follow your content in the future. Thanks a lot, man.
@LukePeters7 ай бұрын
Thank you! I'm glad you found this helpful :)
@hszt44142 жыл бұрын
The best flask file upload tutorial out there!
@LukePeters2 жыл бұрын
I appreciate that :)
@iFloxy2 жыл бұрын
Super tight, clear, and clean tutorial. I like the way you explain things too. This was very helpful, thank you Luke!
@LukePeters2 жыл бұрын
Thank you, Zack! :) Very glad this was clear and helpful.
@rinzu22 Жыл бұрын
Very clear, and answers common questions of beginners. Thank you!
@LukePeters Жыл бұрын
You're welcome! Happy this was helpful.
@eimajin82 жыл бұрын
Thanks Luke, there are few videos about this topic taught with such clarity
@LukePeters2 жыл бұрын
Hey thanks! Glad this was helpful :)
@codingtochangetheworld54959 ай бұрын
Wonderful explanation that I ever heard from KZbin 🎉 .Thank you ❤
@LukePeters7 ай бұрын
Haha, well thank you. I appreciate that 🙂
@oyugoobonyo71173 жыл бұрын
Great video! Absolutely helped me solve a bug that had been troubling me for days. I'd suggest you try using FlaskForm and its validators, a lot of your custom implementations like the allowed extensions configurations are already handled by flaskform.
@LukePeters3 жыл бұрын
Hey Oyugo, thanks for the comment. Glad to hear this video helped! I'll check out FlaskForm 👍🏻 I've never used it because my frontend is usually React, not Flask/Jinja2, and I just use Flask as a backend API.
@Kennethlumor3 жыл бұрын
Sir thank you for this awesome tutorial
@RaheEl_Qaisrani9 ай бұрын
very good video on the topic
@joshuawalker77162 жыл бұрын
Deserves more likes and views
@andrewcarney86312 жыл бұрын
Thank you for this great tutorial!
@alejandrodejesusescarenofl41392 жыл бұрын
Thank you, this was really helpfull!
@hamzawasfi51665 ай бұрын
How to upload many files and get a list of files at the application?
@adithyaparashar4046 Жыл бұрын
how can I rename the filename for the uploaded files. so its easier for placing specific image in specific places?
@aakshkr10 Жыл бұрын
thanks bro
@manishankarkonda76893 жыл бұрын
Hi sir, thanku for the video, How to save these uploads in to the database.
@LukePeters3 жыл бұрын
Hey Manishankar, rather than saving files in the database directly, you should probably save the files in a folder on the filesystem, then save the FILENAME only to the database. Then when you need to use the file in a template, you can get the filename from the database and use the path you chose as your upload directory.
@manishankarkonda76892 жыл бұрын
Hi luke, Is it recommended in production environment to first get the files into upload folder and than save it into the bucket. Is maintaining a folder is good?
@LukePeters2 жыл бұрын
Hi Manishankar, storing and serving files from a folder is 100% okay. This is how most websites on the internet serve files - from a folder on the server. Using a storage bucket from a company that offers this kind of service has some advantages. If you've used up the space on your web server (or anticipate having a LOT of large files), a bucket is probably cheaper per gigabyte than the filesystem on the average web server. Bucket services probably also have good file caching and a global content delivery networks, so files might be served up faster. But don't overcomplicate your tech stack if you don't need to! Use a bucket if you have a reason to, or if you just want to learn about buckets :) Otherwise, serving files from a folder is perfect.
@manishankarkonda76892 жыл бұрын
@@LukePeters Got it sir. I Created a folder and uploaded the files in to that folder. I want to return those files with size. I am trying but i am getting file as a string not the actual file. How can i get the file size after uploading it to the folder.
@LukePeters2 жыл бұрын
@@manishankarkonda7689 1) You can get the file size in memory like this: file = request.files['file'] file.seek(0, os.SEEK_END) file_size = file.tell() #
@Kennethlumor3 жыл бұрын
Sir please and please i want you to do a video on how to add a search to flask app (where for example an admin can search for a record of an item or anything that the result will display
@LukePeters3 жыл бұрын
Hi Kenneth, I will do a tutorial on searching in Flask at some point. It depends on what you're using for a database, though, since searching in MySQL is going to be slightly different than searching in MongoDB, etc.
@gregc.81869 ай бұрын
Hello, I dont know if you are active, but I am getting 403 errors in my python after clicking upload. I am using nginx/flask/gunicorn as my backend. Please advise and thank you
@allmighty20002 жыл бұрын
super underrated , just one doubt , if I deploy it to Heroku still will this saving file to OS particular directory will work or not ?
@LukePeters2 жыл бұрын
I don't use Heroku so I'm not sure how much access they give you to the filesystem. I think any files uploaded to their filesystem will be removed when the app is restarted, so that's obviously not good. You may have to use a third-party storage solution (i.e. Amazon S3 buckets). Or you could just buy a cheap little server from Linode and have full control over the whole system 😃👍🏻
@allmighty20002 жыл бұрын
@@LukePeters thanks 😊 and I have tried doing this in Heroku , it doesn’t allow
@allmighty20002 жыл бұрын
@@LukePeters I am replying back , because when I tried saving the CSV file using CSVFILE_NAME.to_csv("name.csv") then it actually worked, I am not sure if its bug but whenever inside "to_csv" method I am mentioning full path its showing me "Internal Error / Server Overload" , might be some kinda glitch!
@LukePeters2 жыл бұрын
@@allmighty2000 Hmm that sounds strange. Maybe read the documentation on the "to_csv()" function and see if that explains anything?
@manishankarkonda76893 жыл бұрын
HI luke, Is it possible to search a file from the upload folder itself ,prior to saving it to the database. please recommend the solution.
@LukePeters2 жыл бұрын
Hey Manishankar, yes that's very easy! You can use the os.path.exists() function: snipsave.com/user/lukepeters/snippet/gluq0DnTDMgShg6yR2/
@BicMitchum-e7d Жыл бұрын
What if you're working with pdfs? How would you get it to display? Is it possible to do with tag?
@LukePeters Жыл бұрын
A quick Google search (very helpful tool 😉) tells me that you can indeed load a PDF inside an . You can also use the tag.
@BicMitchum-e7d Жыл бұрын
I appreciate you took the time to comment back 🙏 @@LukePeters thank you
@nameaccelerate62492 жыл бұрын
Sir please and please your tutorial is awesome but if you can reupload the code to the github, because it seems nothing is in the app.py file when you open it
@LukePeters2 жыл бұрын
There are two code branches on GitHub: "main" and "completed-tutorial". There's a link to the completed code right on the front page of the Git repository titled "Completed Code". Here's the direct link for you: github.com/LukePeters/flask-file-uploads/tree/completed-tutorial Also, why are you commenting three times from two different accounts? I saw the first comment 🤪
@Kennethlumor2 жыл бұрын
And even github the code you upload there is not complete please help me
@LukePeters2 жыл бұрын
The completed code is in GitHub. It's listed under the large bold heading that says "Completed Code". Here's a direct link for you: github.com/LukePeters/flask-file-uploads/tree/completed-tutorial
@ansarimohamed879 Жыл бұрын
you gotta be kidding me...there is nothing in your code link man
@LukePeters Жыл бұрын
Huh? Did you look at the repo at all? The link for the initial code to begin the tutorial is here: github.com/LukePeters/flask-file-uploads And the code for the finished project is in a different branch there. There’s a big heading in the repo telling you where the completed code is.
@LukePeters3 жыл бұрын
🎨 Here's the CSS for this project: github.com/LukePeters/flask-file-uploads/blob/main/static/styles.css