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 6959813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:19:18+00:00 2026-05-27T15:19:18+00:00

I have a webform in asp.net 4.0 c# it’s about posting book information to

  • 0

I have a webform in asp.net 4.0 c#
it’s about posting book information to sell.

Currently if user upload the book image and not click the “submit” button, the file will still be in my local drive. How do I manage those file/housekeeping on unused file that was not any part of post in .net?

Currently it’s just using this aspx code:

<asp:FileUpload ID="flupload1" runat="server" />
<asp:RegularExpressionValidator ID="revImage" runat="server" ControlToValidate="flupload1"
     ValidationGroup="sell" Display="Dynamic" ForeColor="Red" Text="  Invalid image type"
     ValidationExpression="^.*\.((j|J)(p|P)(e|E)?(g|G)|(g|G)(i|I)(f|F)|(p|P)(n|N)(g|G))$" />

for code behind:

protected void uploadBtn1_Click(object sender, EventArgs e)
{
    if (flupload1.HasFile)
    {
        flupload1.SaveAs(Server.MapPath("productImages") + "//" + flupload1.FileName);
        try
        {
            img1.ImageUrl = "ProductImages//" + flupload1.FileName;
        }
        catch (Exception )
        {

        }
    }
}
  • 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-05-27T15:19:19+00:00Added an answer on May 27, 2026 at 3:19 pm

    The way that we handle similar issues is to have all of the temporary files (uploads, files requested for download) stored in a temporary, well-known directory in the web site.

    Then, when the web app starts (it is scheduled to reset nightly), it removes all files in the directory that are older than 24 hours.

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

Sidebar

Related Questions

The situation I have an ASP.NET Webform that contains some status information about a
I have an ASP.NET Webform which currently calls a Java WebService. The ASP.NET Webform
i have an asp.net webform where the user can enter data and submit into
I have a complicated, very involved ASP.NET WebForm with a large ViewState . Currently,
On my C# asp.net webform I have a search page that has roughly 20
I have a ASP.NET webform that, aside from other controls, has a textbox for
I have an ASP.NET webform on which I use a DropDownList control to allow
I have a asp.net webform with a button. The OnClientClick event is wired to
I have an ASP.NET Webform and inside the form I have an input type
We have a pretty big ASP.NET WebForm (web application) project with a lot of

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.