Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:06:22+00:00 2026-06-15T19:06:22+00:00

I have an upload button on my website and that upload button saves a

  • 0

I have an upload button on my website and that upload button saves a file the user selected on my hard drive (for now), and it also saves the name (with Guid.NewGuid) + a friendly name (actual name) up in the database.

The file is saved at Content/Usercontent (the Guid.NewGuid name), but what I want, is that when you delete a row from your database, that the file in the map Content/Usercontent is also deleted, how do I do this with ASP.NET MVC

EDIT: Why was I voted down? Atleast tell me what I should improve on my question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:06:23+00:00Added an answer on June 15, 2026 at 7:06 pm

    As long as you have hooked into the event called OnDelete (for example) then you could sync this with routine that deletes that associated file.

    I would create a class that is the sole manager for adding and removing files from the database. What I would do when you upload a file is then call the class documentMgr.Save(string fileName, string serverPath, byte[] fileContents).

    On the DocumentManager class I would create a event called FileDeleted where the deegate takes the folowing args (object sender, FileEventArgs fileArgs) and create an event handler on that class called OnFileDeleted(object sender, FileEventArgs fileArgs) and raise the OnFileDeleted event when the DocumentManager.DeleteDocument(string name, string whatever) is called.

    The event handler can be handled from an where then (if it event is public).

    You can hook up the event in the constructor of the DocumentManager then the call with dea with the deleting of the file automatically and by using events, you can opt to do more and extend the functionality later.

    Let me know how you get on

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mobile website that allows users to upload photos using the file
In my website, user have to upload a file, and should have two buttons
I have a file, which the users browse and hit the upload button, i
I'm trying to create a script that will upload a file to a website.
I have a website that plays sound when you click a button. This is
I have an app that requires user to take a picture and then upload
In a ASP.NET C# website I have an input that uploads a file to
I am developing an website in php where user can upload csv file. after
On my website, I have an upload story feature with a user written title
I have an aspx page with multiple FileUpload controls and one Upload button. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.