Тёмный

Uploading Files to Blazor - The Blazor File Upload Mini Course 

IAmTimCorey
Подписаться 417 тыс.
Просмотров 32 тыс.
50% 1

This is the Uploading Files with Blazor mini-course. In this video, we are going to upload a file to the server using Blazor Server. We will look at how to use the multi-select option, how to filter the files by type, how to limit the file size, and more.
Blazor File Upload Mini Course Playlist: • Blazor File Upload Min...
Full Training Courses: IAmTimCorey.com
Source Code: leadmagnets.app/?Resource=Bla...
Mailing List: signup.iamtimcorey.com/

Опубликовано:

 

17 янв 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@k2otoosan
@k2otoosan 8 месяцев назад
Another fantastic series! I am an older guy just now getting into coding. Learning and getting better every time I code, especially when I have a great sensei like Tim Corey!
@IAmTimCorey
@IAmTimCorey 8 месяцев назад
Thanks!
@RiGoRmOrTiSUK
@RiGoRmOrTiSUK Год назад
superb video. thank you for all this content. really happy I managed to get in on the all access pass at Christmas, I'm chewing through your courses and having a blast.
@IAmTimCorey
@IAmTimCorey Год назад
Fantastic!
@HalimEMSL
@HalimEMSL Год назад
Thank you sir, for uploading such a great video on Blazor File uploading. Your explanations were clear and easy to follow, and the examples you provided were extremely helpful. Your video has greatly improved my understanding of this topic and I appreciate the time and effort you put into creating it. Thank you for sharing your knowledge and expertise with the community.
@IAmTimCorey
@IAmTimCorey Год назад
You are welcome.
@barsgulecyuz1765
@barsgulecyuz1765 Год назад
Thanks Tim the simplest and most detailed content I've ever seen about fileupload
@IAmTimCorey
@IAmTimCorey Год назад
You are welcome.
@nssyr
@nssyr Год назад
Thank you Tim! Your video solved my problem. Please don't stop sharing your video with us. I'm really appreciate it!
@IAmTimCorey
@IAmTimCorey Год назад
You're welcome!
@oncalldev
@oncalldev Год назад
As always, your tutorials are top notch. Looking forward to progressing in this mini-course.
@IAmTimCorey
@IAmTimCorey Год назад
Glad you like them!
@brianwiggins6981
@brianwiggins6981 Год назад
Thanks, this is just what I needed.
@IAmTimCorey
@IAmTimCorey Год назад
Glad I could help!
@sandilekhomo3030
@sandilekhomo3030 2 месяца назад
I love that you don't do too much copy and paste on your tutorials. Great content Tim.
@IAmTimCorey
@IAmTimCorey 2 месяца назад
Thank You!
@maximfdrv
@maximfdrv Год назад
Thank you Tim. Such a great lesson.
@IAmTimCorey
@IAmTimCorey Год назад
You are welcome.
@AM-rl8lv
@AM-rl8lv Год назад
Thank you so much Tim!!! Great content as always ;-)
@IAmTimCorey
@IAmTimCorey Год назад
You are welcome.
@propro8040
@propro8040 Год назад
thank you
@IAmTimCorey
@IAmTimCorey Год назад
You're welcome.
@caseypries7559
@caseypries7559 6 месяцев назад
Great job as always Tim. I'm now uploading to a folder on my server that's below the wwwroot so it's inaccessible to the public. I have stored their info in SQL server. Is there any way to show them on click on my site with them hidden as they are? A way to filestream them back to maybe and img tag src or something? Also a way to download them to the client on demand? Do you have a video showing such a scenario?
@shararehbanei3871
@shararehbanei3871 Год назад
Thanks for your great videos same as always, just I got in stuck with uploading File to Blazor from Azure Blob Storage,more less I did some configuration with that But I have no idea what to do it exactly to work correctly,of course I try to get some suggestions from Chat GPT but it’s answers somehow messy and not so useful for me, Thanks for your replying 🙏
@HassanAli-pj5cn
@HassanAli-pj5cn 11 дней назад
How can we display the uploaded file in img tag using blazor??
@sanjaypaudel2386
@sanjaypaudel2386 Год назад
Such a great tutorial. Simple and clear. I've another question that's not related to file upload. You know, we can mix multiple frameworks in a single project. I mean we can use blazor along with MVC.But Just because we can do that should we be doing it? This is what is happening in one of the projects I'm involved in and I'm not quite satisfied with it.
@IAmTimCorey
@IAmTimCorey Год назад
Yes, it is a good thing. Use the best option for the specific task. With that being said, don't go crazy. Otherwise, it will be harder to understand what is happening when going through the code.
@MrMAbukhadra
@MrMAbukhadra Месяц назад
That’s great and helpful but why you didn’t use the environment service instead of using configuration variable
@vijayk7795
@vijayk7795 3 месяца назад
I need to select folder instead of files. Could you please explain?
@joelrobinson7395
@joelrobinson7395 Год назад
Very helpful video! I am running into an error where the Directory is created, but the file is not, is there any reason that might happen?
@IAmTimCorey
@IAmTimCorey Год назад
Check for errors. If there aren't any, walk through your code and see if you can figure out why.
@levine6581
@levine6581 Год назад
For some reason accept parameter in InputFile doesn't limit the files extension to filter in Open dialog. Dropdown only lists "Custom Files" and "all Files". Tried ".png,.jpg,.jpeg" and "image/png, image/jpg, image/jpeg". Didn't help. Chrome or Edge - doesn't matter. What is the trick?
@IAmTimCorey
@IAmTimCorey Год назад
Just add *accept=".jpg,.png,.jpeg"* to the InputFile item.
@levine6581
@levine6581 Год назад
@@IAmTimCorey That's exactly what I have.. But I found why.. Did it on other PC. It works fine in Windows 10 but doesn't in Windows 11. I guess MS modified Open Dialog in Win 11 and broke this functionality! :(
@Richard-vf1gb
@Richard-vf1gb Год назад
You’re just amazing! But please can you do a quick one on blazor wasm? I go it to work in development but it doesn’t work in production in blazor wasm!
@IAmTimCorey
@IAmTimCorey Год назад
I've got videos on Blazor WASM on this channel. Do you mean specifically file uploading or just WASM in general?
@Richard-vf1gb
@Richard-vf1gb Год назад
@@IAmTimCorey File Uploading in WASM ! Thanks alot!
@MrMilesfinn
@MrMilesfinn Год назад
@@IAmTimCorey I too would like to see file uploading for WASM. Great video.
@naveedkhanhome
@naveedkhanhome Год назад
Nice Sir, i have followed all the steps as in your video but image files uploaded with png and jpg are not opening either these are corrupted or showing blank need help
@IAmTimCorey
@IAmTimCorey Год назад
I'm not sure what the issue is. The code does work, so maybe check to see what is different or step through the code to see what it could be.
@naveedkhanhome
@naveedkhanhome Год назад
@@IAmTimCorey Sir Thanks, I am making a little mistake. Now working fine for all types of files
@JoeBonez
@JoeBonez Год назад
Excellent video. “await using” was new to me, but i now know about IAsyncDisposable :)
@IAmTimCorey
@IAmTimCorey Год назад
Glad it was helpful!
@Boscor
@Boscor Год назад
Great! Now how to download files, from our own server and azure storage please
@IAmTimCorey
@IAmTimCorey Год назад
Downloading files is coming, although just from our own server. Adding Azure storage won't be much different, though.
@dyakobaram
@dyakobaram Год назад
wouldn't be more readable if the new file name code be "var newFileName=Guid.NewGuid()+Path.GetExtension(file.Name);" its much cleaner in my opinion
@Marko-the-Beast-Master
@Marko-the-Beast-Master Год назад
pls also include Excel files later if possible, like parsing Sheets, Columns etc.
@IAmTimCorey
@IAmTimCorey Год назад
I already have videos on that topic: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-j3S3aI8nMeE.html and ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-wyoCxzRLUsQ.html
@justfair4181
@justfair4181 3 дня назад
Just a reminder: this is not the best security approach for uploading files in Blazor. Microsoft provides best practices on their portal if you want to explore this topic further.
@IAmTimCorey
@IAmTimCorey День назад
This approach is just fine for a lot of situations. The best practices in this case don't apply to all situations.
@rockymarquiss8327
@rockymarquiss8327 Год назад
I understand your reasoning of putting in the return right away, but as a programmer for 41 years I really don't think that is wise. A routine should have one entry point with known parameters and one exit point at all times. I realize that some of this is personal programming style but this can make it more challenging for program modifications down the line. For example, if later they want all possible errors to display - too many files, one too large, etc.. or add the ability to define hard errors (don't process at all) and soft errors (caution user and allow override)? You may have multiple soft errors in a given upload... it's far easier to do when there's one exit point than having to modify a program with multiple exit points... far too easy to get spaghetti code IMO.
@IAmTimCorey
@IAmTimCorey Год назад
I get what you are saying, but usually the need for one exit point is because your code is doing too much. That's the underlying problem. Making just one exit point is just putting a band-aid on the real problem.
@rockymarquiss8327
@rockymarquiss8327 Год назад
@@IAmTimCorey It's not so much that it's doing so much, they are more flexible. My routines are short and narrow in focus. If they get too long I refactor them into multiple routines. But in my experience, multiple exit points ultimately create what I call spaghetti code. With one exit point I can look at a glance what the input is expected to look like and what the output is expected. With multiple exit codes it isn't as clear. If I want to change the code where something always runs it is more complicated because of early exits - even Microsoft allows for this concept in the Try statement - you can catch a problem, go to the exception, but regardless Finally executes. One entry - one exit - always. Far more straight foward, in my opinion.
@adriangabrielalexandrescu2705
@adriangabrielalexandrescu2705 10 месяцев назад
This is how to map for example to look for another location outside server folder (wwwroot): In Program.cs / Startup.cs (depending on .net version) add under app.UseStaticFiles() this code : app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(@"E:\images"), RequestPath = "/images" });
@IAmTimCorey
@IAmTimCorey 10 месяцев назад
Thanks for sharing! You will need to grant the user that is running your application permissions to that folder as well. Just mapping it won't be enough.
@rockymarquiss8327
@rockymarquiss8327 Год назад
May I make a suggestion? In naming the file, use a naming convention that connects it to the data. For example, let's say you're creating a site to allow people to sell their cars and they are uploading pictures of the car they are selling. Making the name of the file with sellerid-year-make-model-color-seq# format for example. If the internal seller id is 0005, it's a 2005 red Ford Mustang it would be 0005-2005-ford-mustang-red-0001.jpg - they'd have to enter the data before doing the upload, the data matches the images and vice versa. While you probably still want a xref table for various reasons this makes the process somewhat self documenting and lends itself to do things like a directory search for 0005-2005-ford-mustang-red* to get all files associated with that entry.
@IAmTimCorey
@IAmTimCorey Год назад
The issue with this is that it relies on user input unless you only allow dropdown values. If you only allow dropdown values, you then are subject to repetition. How many white Ford F150s from 2019 are out there? A TON. So now you are relying on the UserId to be the unique part. However, what if the user was a small business and they bought two white F150s at the same time. Now they want to sell them both. Now you have either duplicates or you have to add an additional factor to the file name. Trying to come up with unique names that are meaningful and also stand up to production-scale issues is really hard.
@rockymarquiss8327
@rockymarquiss8327 Год назад
@@IAmTimCorey In the scenario given the user would have to put in information - his contact info, description of what he/she is selling, etc.. anyway. Making the upload of the images takes advantage of the information they have to enter anyway. Part of behind the scenes could be a sales id to be included in the file name connecting it with that specific sale item - I didn't think of that during the example. There would be multiple pictures as photos of front, side, engine, etc would be uploaded - this is handled by the seq # at the end. You are right that coming up with unique names that are meaningful can be difficult - but with a little thought and planning it can usually be accomplished. The more you can make your tables, rows, columns, code and even uploads be self documenting, the better off you are, in my experience. While I understand the issue you bring up in depending on user input (in the above example you can do most of it using drop down boxes - but that isn't always the case).
@rockymarquiss8327
@rockymarquiss8327 Год назад
@@IAmTimCorey You could simplify the example by basically using the transaction key as being the main naming criteria. In the example I gave most likely there'd be a sales item id as the primary key. image-pk-seq#.jpg where pk is the primary key.
Далее
🎙ПЕСНИ ВЖИВУЮ от КВАШЕНОЙ🌇
3:16:26
Is Blazor Better than React?
14:25
Просмотров 45 тыс.
How To Learn Blazor In 2023
59:44
Просмотров 88 тыс.
Brutally honest advice for new .NET Web Developers
7:19