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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:07:47+00:00 2026-06-15T18:07:47+00:00

I have never tried to save a video before so I don’t know much

  • 0

I have never tried to save a video before so I don’t know much about this. I know if the video is small I can convert to byte array and save to db, however to be more efficient I would like to learn how to save any uploaded video(s) to my servers file and then just save the file path of the video in my database table. I have absolutely no idea how to begin to do this. I’ve seen this example below but not too sure what its doing. To me it appears it’s saving any uploaded videos that any user uploads to the App_Data folder. Is that right? Any help is greatly appreciated.

[HttpPost]
public ContentResult UploadFiles()
{
       var r = new List<ViewDataUploadFilesResult>();

       foreach (string file in Request.Files)
       {
        HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
        if (hpf.ContentLength == 0)
        continue;

    string savedFileName = Path.Combine(Server.MapPath("~/App_Data"), Path.GetFileName(hpf.FileName));
    hpf.SaveAs(savedFileName); // Save the file

    r.Add(new ViewDataUploadFilesResult()
    {
        Name = hpf.FileName,
        Length = hpf.ContentLength,
        Type = hpf.ContentType
    });
}
// Returns json
return Content("{\"name\":\"" + r[0].Name + "\",\"type\":\"" + r[0].Type + "\",\"size\":\"" + string.Format("{0} bytes", r[0].Length) + "\"}", "application/json");
}
  • 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-15T18:07:49+00:00Added an answer on June 15, 2026 at 6:07 pm

    Your assumption is correct.. it is also returning a JSON string with the name, content type and length. This is no doubt an asynchronous upload.

    It is generally better to store the files on disk rather than use a database. A couple of reasons are:

    • Less overhead. It’s quicker to load via the filesystem than via a connection to a (potentially non-local) database.
    • Large object allocations are minimal: A large object is already created during the upload. If you were to convert to a byte array you’re creating yet another large object in memory.

    One reason you might want to use a database is for custom versioning or keeping proper track of files (via extra metadata.. etc). However, this can generally be done using a filesystem also.

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

Sidebar

Related Questions

I have never used Foxpro before. Can you convert the following Foxpro code into
I have never saved and retrieved an image to and from the database before.
I have never programed in bash before. I am reading all the files that
I have never come across this issue but most recently I noticed that a
I have never thought about until recently, but I'm not sure why we call
I have never made a blog before. I am proficient with html and css.
I have never really done much C but am starting to play around with
So I have an HTML form where a user can upload an image. This
I have never done any Windows coding and I would like to give it
I have never programmed a gadget for Vista or Seven, but I would like

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.