public ActionResult upload(Model_demo obj) { HttpPostedFileBase file = Request.Files["file1"]; demo tb = new demo(); var filename = Path.GetFileName(file.FileName); if (file.FileName != null) { string keyName = filename; int fileExtPos = keyName.LastIndexOf("."); if (fileExtPos >= 0) { keyName = keyName.Substring(0, fileExtPos); } var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); string thumbnailJPEGpath = Server.MapPath("~/fileupload/" + keyName + ".jpg"); FFMpegConverter ffmpeg = new FFMpegConverter(); ffmpeg.GetVideoThumbnail(path, thumbnailJPEGpath, 2); var path2 = Path.Combine(Server.MapPath("~/fileupload"), keyName + ".jpg"); S3Class s3obj = new S3Class(); string str2 = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_')); string str = s3obj.putObject("transcoder.thumbnail.video.streaming", path2, keyName + ".jpg"); tb.name = str; } db.demos.InsertOnSubmit(tb); db.SubmitChanges(); return(View()); }
public ActionResult Create(Model_video obj) { HttpPostedFileBase file = Request.Files["file1"]; tbl_video tb = new tbl_video(); if (file.FileName != "") { var filename = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); S3Class s3obj = new S3Class(); string str = s3obj.putObject("transcoder.thumbnail.video.streaming", path, file.FileName); tb.video_thumb = str; } tb.login_id = obj.login_id; tb.cat_id = obj.cat_id; tb.sub_cat_id = obj.sub_cat_id; tb.video_name = obj.video_name; tb.video_des = obj.video_des; tb.video_path = obj.video_path; tb.video_date = DateTime.Today.Date; db.tbl_videos.InsertOnSubmit(tb); db.SubmitChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Model_Login_Register obj) { if (db.tbl_logins.Where(x => x.email == obj.mdlogin.email).Count() == 0) { string host = Request.Url.Authority; string key = GetUniqueKey(64); string sendurl = "http://" + host + "/login/Activate/" + key; SendMail(obj.mdlogin.email, obj.mdregister.reg_fname, "Confirm Registration Email", sendurl); HttpPostedFileBase file = Request.Files["file1"]; tbl_login tbl = new tbl_login(); tbl.email = obj.mdlogin.email; tbl.password = obj.mdlogin.password; tbl.log_status = key; tbl.log_date = DateTime.Today; db.tbl_logins.InsertOnSubmit(tbl); db.SubmitChanges(); tbl_registration tb = new tbl_registration(); if (file.FileName != "") { var filename = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); S3Class s3obj = new S3Class(); string str = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_')); tb.reg_photo = str; } tb.reg_fname = obj.mdregister.reg_fname; tb.reg_lname = obj.mdregister.reg_lname; tb.reg_gender = obj.mdregister.reg_gender; tb.reg_address = obj.mdregister.reg_address; tb.country_id = obj.mdregister.country_id; tb.state_id = obj.mdregister.state_id; tb.city_id = obj.mdregister.city_id; tb.reg_phno = obj.mdregister.reg_phno; tb.login_id = tbl.login_id; db.tbl_registrations.InsertOnSubmit(tb); db.SubmitChanges(); //string host = Request.Url.Authority; //host = host + GetUniqueKey(64); //string sendurl = "http://" + host; //SendMail(obj.mdlogin.email, "Confirm Email", sendurl); return(RedirectToAction("Confirm")); } else { ModelState.AddModelError("error", "Error! Your email is already registered with us"); ViewBag.genderid = new SelectList(db.tbl_genders.ToList(), "gen_id", "gen_name"); ViewBag.countryid = new SelectList(db.tbl_countries.ToList(), "country_id", "country_name"); ViewBag.stateid = new SelectList(db.tbl_states.ToList(), "state_id", "state_name"); ViewBag.cityid = new SelectList(db.tbl_cities.ToList(), "city_id", "city_name"); return(View("SignUp")); } }
public ActionResult Edit(Model_Login_Register obj) { HttpPostedFileBase file = Request.Files["file1"]; tbl_login tbl = db.tbl_logins.Where(x => x.login_id == obj.mdlogin.login_id).Single <tbl_login>(); tbl.email = obj.mdlogin.email; tbl.password = obj.mdlogin.password; db.SubmitChanges(); tbl_registration tb = db.tbl_registrations.Where(x => x.reg_id == obj.mdregister.reg_id).Single <tbl_registration>(); if (file.FileName != "") { var filename = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); S3Class s3obj = new S3Class(); string str = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_')); tb.reg_photo = str; SessionData.photo = str; } tb.reg_fname = obj.mdregister.reg_fname; tb.reg_lname = obj.mdregister.reg_lname; tb.reg_address = obj.mdregister.reg_address; tb.country_id = obj.mdregister.country_id; tb.state_id = obj.mdregister.state_id; tb.city_id = obj.mdregister.city_id; tb.reg_phno = obj.mdregister.reg_phno; tb.login_id = tbl.login_id; db.SubmitChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult upload(Model_video obj) { HttpPostedFileBase file = Request.Files["file1"]; tbl_video tb = new tbl_video(); if (file.FileName != "") { var filename = Path.GetFileName(file.FileName); string keyName = filename; int fileExtPos = keyName.LastIndexOf("."); if (fileExtPos >= 0) { keyName = keyName.Substring(0, fileExtPos); } var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); string thumbnailJPEGpath = Server.MapPath("~/fileupload/" + keyName + ".jpg"); FFMpegConverter ffmpeg = new FFMpegConverter(); ffmpeg.GetVideoThumbnail(path, thumbnailJPEGpath, 4); var path2 = Path.Combine(Server.MapPath("~/fileupload"), keyName + ".jpg"); S3Class s3obj = new S3Class(); string str2 = s3obj.putObject("transcoder.input.video.streaming", path, file.FileName.Replace(' ', '_')); string str = s3obj.putObject("transcoder.thumbnail.video.streaming", path2, keyName + ".jpg"); tb.video_thumb = str; tb.video_path = str2; } tb.login_id = obj.login_id; tb.cat_id = obj.cat_id; tb.sub_cat_id = obj.sub_cat_id; tb.video_name = obj.video_name; tb.video_des = obj.video_des; tb.video_date = DateTime.Today; tb.video_paid = false; db.tbl_videos.InsertOnSubmit(tb); db.SubmitChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Model_video obj) { HttpPostedFileBase file = Request.Files["file1"]; tbl_video tb = db.tbl_videos.Where(x => x.video_id == obj.video_id).Single <tbl_video>(); if (file.FileName != "") { var filename = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/fileupload"), filename); file.SaveAs(path); S3Class s3obj = new S3Class(); string str = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_')); tb.video_path = str; } tb.cat_id = obj.cat_id; tb.sub_cat_id = obj.sub_cat_id; tb.video_name = obj.video_name; tb.video_des = obj.video_des; db.SubmitChanges(); return(RedirectToAction("Index")); }