Similar Posts

Leave a Reply

Your email address will not be published.

21 Comments

  1. Dear Mr. Mukesh Murugan ,

    This is Hedayat Hoshmand from Kabul,

    I have found your articles very useful and easy to learn, spatially the way that you have explained the things, I appreciate your hard work to provide great learning articles, keep going on, God bless you,

  2. Dear Mukesh,

    How about uploading a whole directory (with its subdirectories) to file system?

    1. Hi Majid, Yes it is totally possible with this same approach. The only change will be that you would have to run a function like string[] subs= Directory.GetDirectories(root); which gets you all the directories within a root. (You would have to run this recursively.) After that you would have a list of filepaths and a list of directory. With this data, simply create new directories and copy the files into the locations.
      Thanks for reaching out! Stay safe

    1. Hi Laurentiu, Thanks for writing.
      Here are the source codes for the projects
      1. File Upload https://github.com/iammukeshm/FileUpload.MVC
      2. Mail Service https://github.com/iammukeshm/MailService.WebApi

      Using EF Core, Create a new Table MailMessage, that has all the properties of a mail message, i.e, MailId, Body, Subject, etc. In my FileUpload project, we already are able to save the file data to the Database. In my FileModel.cs Just add a Reference Key to MailId (Each mail will have a mail id). That means, now we have a relation between the files and the mails. get it? Now all you have to do it to Save the sent mail to the database using EFCore. Hope it is clear.

      For the attachment count limitation, just handle it in the SendMailAsync Method.

      1. Hi

        Thanks for relpy. I will check in the next days.
        In fact what bothers me is the multi file attachment. I have tried a way where I was able to save multiple attachments on file system, but as mail attachment, their content is empty.

  3. Dear Mukesh, Please can you assist with AspNet Identity, thus extend the identity to include a user photo, where you can retrieve and display the uploaded photo in a navbar

    1. Hi Thomas, Thanks for writing.
      Are you familiar with IdentityUser class? What you will have to do, Create a new class ‘ApplicationUser’ which inherits from the IdentityUser Class. Like this, we can extend the default user class of ASPNET Identity and add new params like userImage. In the ApplicaionUser class add a property to hold image data ( public byte[] ProfilePicture { get; set; } ). Get it? Now in the services containers add this ApplicaionUser class instead of IdentityUser. This is how to handle it on the data. From the MVC end, it is pretty straight forward. Thanks

  4. Most of us developers have heard of KUDVENKAT, he is a legend. When I introduced my work colleague to your work and articles, I referred to you as “The new junior KUDVENKAT”, not because of junior knowledge, but age only.
    Its so refreshing to discover someone who is clearly passionate about their work and at the same time offering up such valuable knowledge, you are helping many! I have a project that I will be modeling on this article, once funds come in, I hope to buy you dozens of coffees!!
    Thank you so much!!

  5. Hello Mukesh

    Thanks for your article and indeed very helpful. Can you please let me know how to edit the item. Example what i have already added, for that entry can i edit and add more file. How to do that. Will be great to know the code for the same.

    Keep up the good work

  6. Where should I Put these upload and download task if I implementation OnionArchitechture for a entity which have a properties related to image such as.
    Public class Person
    {
    Int Id
    String Name
    String ImagePath
    }
    Thanks.

  7. Hello mr mukesh, i have problems downloading the files from the database if you could help me, that would be great

  8. Hi,
    Thanks to your explanation.
    I would like to know if I can apply this code if my data is in Sql Server File Table.
    Thanks in advance to your reply