日期:2014-05-17  浏览次数:20485 次

哇哇的,FLV视频截图老是搞不好。
本帖最后由 woyaodubo 于 2013-12-10 13:04:02 编辑
        protected void bntup_Click(object sender, EventArgs e)
        {
            string getdatetime = DateTime.Now.ToString("yyMMddHHmmssfff");
            string fileName = "Teacher\\Video\\" + getdatetime + System.IO.Path.GetExtension(uploadfile.FileName);
            string sql = "insert into Video(Video_Name,Video_Path,Video_PostDate,TeacherName,College,Profession,Subject,Is_Rec,Is_Top) values('" + this.uploadfile.FileName + "','" + getdatetime + System.IO.Path.GetExtension(uploadfile.FileName) + "','" + DateTime.Now.ToString("yy/MM/dd HH:mm") + "','" + Session["UserName"].ToString() + "','" + this.DropDownList_college.SelectedValue + "','" + this.DropDownList_profession.SelectedValue + "','" + this.DropDownList_subject.SelectedValue + "','" + cbox + "','" + cbox2 + "')";

            string filePath = uploadfile.PostedFile.FileName;
            string fileExt = filePath.Substring(filePath.LastIndexOf(".") + 1);
            if (uploadfile.FileName != "")
            {
                if (fileExt.ToLower() == "rmvb" || fileExt.ToLower() == "wmv" || fileExt.ToLower() == "swf" || fileExt.ToLower() == "flv")
                {
                    string playFile = "Teacher/playFile/" + getdatetime + ".flv"; //playFile *1*
                    string videoImg = "Teacher/videoImg/" + getdatetime + ".jpg";
                    if (fileExt.ToLower() == "flv")
                    {
                        bool add = mydata.ExceSQL(sql);  //不能放到if外面,否则即使不能上传文件,但数据库仍然会插入记录。
                        if (add)
                        {
                            uploadfile.SaveAs(Server.MapPath("~/" + fil