asp.net mvc中實現視頻自動上傳

來源:互聯網
上載者:User

標籤:

         在視頻上傳這兒做了好長時間,想了很多辦法。因為想做的是當點擊表徵圖的時候就讓視頻自動開始上傳不需要點提交按鈕,而上傳控制項file需要點擊提交按鈕之後才能上傳。        

<body>    <div class="container">        <div class="panel ">            <div class="header">                <p>上傳視頻</p>            </div>            <div class="panel-body">                <div class="row-fluid">                    <div class="picture">                        <img style="cursor: pointer;" alt="" id="shangchuan" src="../../images/上傳表徵圖.jpg" />                    </div>                    <div class="picture2">                      @* @using (Html.BeginForm("Index", "UpLoad", FormMethod.Post, new { enctype = "multipart/form-data" }))                        {                         *@<form name="form1" action="/Upload" method ="post"enctype = "multipart/form-data" ><input type="file" name="file" id="myfile" value="" onchange ="UploadFile();" />                           @*<input type="submit" name="Submit" id="Submit" />*@ </form>                                                                                      @* }*@</div>                </div>                <div class="t">上傳視頻,即表示您已同意<a href="Declaration"><strong>校園視頻上傳服務條款</strong></a>,請勿上傳色情,反動等違法視頻</div>                <hr />            </div>        </div>    </div></body>

      效果(有待上傳。)


   Controller 裡:     

public class UpLoadController : Controller    {                 //GET: /UpLoad/        public ActionResult Index()        {            return View();        }        public ActionResult Declaration()        {            return View();        }        [AcceptVerbs(HttpVerbs.Post)]        public ActionResult Index(HttpPostedFileBase file,  uploadModel model)        {            if (file.ContentLength > 0)            {                //獲得儲存路徑                string filePath = Path.Combine(HttpContext.Server.MapPath("~/Uploads"),                                Path.GetFileName(file.FileName));                file.SaveAs(filePath);                model.vedio = filePath;                model.Id = Guid.NewGuid();                //model.Id=Request["text"];                uploadDB.UploadModel.AddVedio(model);                           }            return View();        }    }
             視頻的上傳完成了,上傳時候的進度條又是一個痛點。還要繼續攻克。

       

asp.net mvc中實現視頻自動上傳

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.