C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Video File- Upload & Set a Default Picture


Posted Date: 16 Jun 2008    Resource Type: Code Snippets    Category: C# Syntax

Posted By: Rumpa M       Member Level: Gold
Rating:     Points: 8




protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
videofile();
}
}

public void videofile()
{
DataList1.DataSource = vob.getvideos();
DataList1.DataBind();
}
if (this.FileUpload1.HasFile)
{
string userflname = ".\\upload" + "\\"; //".\\userfolder\\" + ufdname + "\\";

string cliptype = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName);
if (cliptype == ".mpeg")
{
string clipname = FileUpload1.PostedFile.FileName;
string name = clipname.Substring(clipname.LastIndexOf(@"\"));
string name1 = name.Remove(name.IndexOf(@"."));

string name2 = name1.Substring(1);
string newclipname = (string)Session.SessionID + "_" + name2 + 1;
string uploadpath = Request.MapPath(".\\upload\\");
FileUpload1.PostedFile.SaveAs(uploadpath + newclipname);

string apppath = Request.PhysicalApplicationPath;
string inputpath = apppath + "upload\\" + newclipname;
string ss = apppath + "upload\\" + newclipname;
string outputpath = apppath + userflname + newclipname + ".flv";

string fileargs = " -i \"" + inputpath + "\" \"" + outputpath + "\"";

System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = apppath + "ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = fileargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();

string inputpath1 = apppath + userflname + newclipname + ".flv";
string outputpath1 = apppath + userflname + "%d" + newclipname + ".jpg";

string fileargs1 = " -i \"" + inputpath1 + "\" -an -ss 00:00:04 -an -r 1 -vframes 1 -y \"" + outputpath1 + "\"";
System.Diagnostics.Process proc1 = new System.Diagnostics.Process();
proc1.StartInfo.FileName = apppath + "ffmpeg\\ffmpeg.exe";
proc1.StartInfo.Arguments = fileargs1;
proc1.StartInfo.UseShellExecute = false;
proc1.StartInfo.CreateNoWindow = false;
proc1.StartInfo.RedirectStandardOutput = false;
proc1.Start();
proc1.WaitForExit();
File.Delete(ss);

string dt = System.DateTime.Now.ToShortDateString();
string movie1 = newclipname + ".flv";
string img1 = "1" + newclipname + ".jpg";
string s = userflname + movie1;
string s1 = userflname + img1;


string str11 = Request.PhysicalApplicationPath;
System.IO.FileStream theFLV = System.IO.File.OpenRead(str11 + s);

string vidpath = userflname + newclipname + ".flv";
string vidpic = userflname + img1;


vob.getvideo_path = vidpath;
vob.getvideo_pic = vidpic;
vob.getcaption = TextBox1.Text;
vob.getwhen = DateTime.Now;
vob.videoinsert();
}
else if (cliptype == ".flv" || cliptype == ".swf")
{
string clipname = FileUpload1.PostedFile.FileName;
string name = clipname.Substring(clipname.LastIndexOf(@"\"));
string name1 = name.Remove(name.IndexOf(@"."));

string name2 = name1.Substring(1);
string newclipname = (string)Session.SessionID + "_" + name2 + 1;
string uploadpath = Request.MapPath(".\\upload\\");
FileUpload1.PostedFile.SaveAs(uploadpath + newclipname);

string apppath = Request.PhysicalApplicationPath;
string inputpath = apppath + "upload\\" + newclipname;
string ss = apppath + "upload\\" + newclipname;
string outputpath = apppath + userflname + newclipname + ".flv";

string fileargs = " -i \"" + inputpath + "\" \"" + outputpath + "\"";

System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = apppath + "ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = fileargs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();

string inputpath1 = apppath + userflname + newclipname + ".flv";
string outputpath1 = apppath + userflname + "%d" + newclipname + ".jpg";

string fileargs1 = " -i \"" + inputpath1 + "\" -an -ss 00:00:04 -an -r 1 -vframes 1 -y \"" + outputpath1 + "\"";
System.Diagnostics.Process proc1 = new System.Diagnostics.Process();
proc1.StartInfo.FileName = apppath + "ffmpeg\\ffmpeg.exe";
proc1.StartInfo.Arguments = fileargs1;
proc1.StartInfo.UseShellExecute = false;
proc1.StartInfo.CreateNoWindow = false;
proc1.StartInfo.RedirectStandardOutput = false;
proc1.Start();
proc1.WaitForExit();
File.Delete(ss);

string dt = System.DateTime.Now.ToShortDateString();
string movie1 = newclipname + ".flv";
string img1 = "1" + newclipname + ".jpg";
string s = userflname + movie1;
string s1 = userflname + img1;

string str11 = Request.PhysicalApplicationPath;
System.IO.FileStream theFLV =
System.IO.File.OpenRead(str11 + s);
string vidpath = userflname + newclipname + ".flv";
string vidpic = userflname + img1;

vob.getvideo_path = vidpath;
vob.getvideo_pic = vidpic;
vob.getcaption = TextBox1.Text;
vob.getwhen = DateTime.Now;
vob.videoinsert();
}
TextBox1.Text = "";
}
else
{
Page.RegisterStartupScript("vob", "");
}
videobind();
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Syntax For ItemCommand Of DataList
Previous Resource: Probing
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use