Total Pageviews

Friday 25 September 2015

How to save a video in folder after upload in asp.net

In aspx file
---------------

using System;
using System.Web;
using System.IO;


file.SaveAs(Server.MapPath("~/videos/") + file.FileName);
Stream streamfile = file.InputStream;


OR

In ashx file
---------------

using System;
using System.Web;
using System.IO;


  HttpPostedFile file = null;

        if (context.Request.Files.Count > 0)
        {
            file = context.Request.Files[0];
            file.SaveAs(HttpContext.Current.Server.MapPath("~/videos/") + file.FileName);
            Stream streamfile = file.InputStream;
        }

No comments:

Post a Comment