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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:23:31+00:00 2026-05-23T07:23:31+00:00

I have a asp.net web application using MVC framework, the website allows the registrars

  • 0

I have a asp.net web application using MVC framework, the website allows the registrars to upload some identification documents.

I want the best option to upload these documents :

  • option 1- make a directory in the website folder and save its name in the website web.config file, and save the document file name in my database, so when I want to compose download link I have to combine the root url and the folder name and the
    document file name.

    for example http://www.website.com +
    “/DoucmentsFolder” +
    “/Documentfilename “

  • option 2- save the entire file in the database, and each time I need the file to be downloaded, I have to save it to temporary folder and compose a link to the file, and make sure to delete the file after the user has gotten the file.
  • may be there are other suggestion from you .

thanks

  • 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-23T07:23:32+00:00Added an answer on May 23, 2026 at 7:23 am

    The issues with using a FileStore are multiple:

    1) Clean-up – you need to leave your file there long enough to be requested and collected, but how do you clean up? If you don’t you run the risk of running out of space. The best way is to have a scheduled task run every so often and delete files older than say an hour – but this is still messy.

    2) Doesn’t scale well – unless you write to a SAN – in a web-garden/farm scenario the users request for the file may come to a different server than that which stored it – unless you constrain your system to force all requests from a user to use the same server.

    3) Not performant – compared with database operation.

    So I would say database for sure – and it’s far easier to do this than you illustrate.

    Instead of creating a file and a link to it, return the file as a FileContentResult:

     public FileContentResult GetFile(int fileId)
    {
            myFile MyFile = fileRepository.Get(fileId);
            return MyFile(file.Data, file.MimeType);
        }
    }
    

    where MyFile looks like:

     public class MyFile
     {
        public MyFile(byte[] fileData, string mimeType)
        {
           this.FileData = fileData;
           this.MimeType = mimeType;
        }
    
        public virtual int Id {get; private set;}
        public virtual byte[] FileData { get; set; }
        public virtual string MimeType { get; set; }
    }
    

    To Store the File

     [HttpPost]
     public ActionResult SaveFile(HttpPostedFileBase userFile)
     {
        MyFile myFile = new MyFile(new byte[userFile.ContentLength], userFile.ContentType)
        userFile.InputStream.Read(MyFile.FileData, 0, userFile.ContentLength);
    
        fileRepository.Save(myFile);
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created a web application, using ASP.NET, that allows users to upload documents
I have a web application using ASP.NET 2.0 and I want to know if
I have a asp.net web application which has a number of versions deployed on
I have an ASP.NET web application which does the following: Reads an Excel file.
We have an intranet asp.net web application which uses the OOTB ASP.net membership and
Suppose you have two seperate ASP.NET Web Application projects that both need to use
We have a ASP.Net 2.0 web application up and running with the server in
I have a really simple ASP.NET web application and a web setup project that
I have a scenario where users of my ASP.NET web application submit testimonials consisting
I have VS2005 and I am currently trying to debug an ASP.net web application.

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.