Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


  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
      2. Mail Service

      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

  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

  9. Getting below mentioned error post getting into File tab.

    “SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 – Local Database Runtime error occurred. The specified LocalDB instance does not exist. )”

    can you help me configure the same and also let me know, how to change the upload path…

  10. Hi there. I’ve looked at so many tutorials on uploading files and downloading them. How can I upload to the db and have the file stored in a directory outside of the project? I eventually want to view, download, upload and delete my file from the db and the directory outside the project.