protected void Button1_Click(object sender, EventArgs e) { //check file type, supported types: .mp4, string[] SupportedFileTypes = { ".mp4", ".flv", ".mkv" }; string ext = Path.GetExtension(NewVideoFile.PostedFile.FileName); if (SupportedFileTypes.Contains(ext)) { //get selected course if (IOUtil.StoreVideo(NewVideoFile.PostedFile, forCourse.SelectedItem.Text, forCourse.SelectedValue) == true) { //([ForCourse], [FilePath], [VideoTitle], [VideoDesc], [VideoTimeLength]) if (SqlUtil.CourseStoreVideoData(forCourse.SelectedValue, IOUtil.CreateShortFilepath(NewVideoFile.PostedFile, forCourse.SelectedValue), NewVideoTitle.Text, NewVideoDesc.Text, IOUtil.GetVideoDuration(IOUtil.CreateFilepath(NewVideoFile.PostedFile, forCourse.SelectedValue).ToString())) == true) //damn thats alot to .toString(), works tho { //success msg msgLbl.Text = "success. file: " + NewVideoFile.PostedFile.FileName.ToString(); Response.Redirect("EditCourse.aspx?Q=" + forCourse.SelectedValue); } else { msgLbl.Text = "failed to upload"; } } else { //err, post err msg to screen msgLbl.Text = "failed to upload"; } } else { msgLbl.Text = "File type not supported"; } }