How to upload the video files on asp.net application?

Posted by Anilkumar431 under ASP.NET on 12/4/2012 | Points: 10 | Views : 1687 | Status : [Member] | Replies : 1
hi all,
how to Upload the video files on asp.net application....
give me the reply how to do this on my application...




Responses

Posted by: Manoj_B on: 12/4/2012 [Member] Starter | Points: 25

Up
0
Down
hii,

use this code,

 private void cmdUpload_Click(object sender, System.EventArgs e)

{

if (( File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0))
{
//determine file name
string sFileName = System.IO.Path.GetFileName(File1.PostedFile.FileName);
try
{
if (File1.PostedFile.ContentLength <= lMaxFileSize)
{
//Save File on disk
File1.PostedFile.SaveAs(sFileDir + sFileName);
lblMessage.Visible=true;
lblMessage.Text="File: " + sFileDir + sFileName + " Uploaded Successfully";
}
else //reject file
{
lblMessage.Visible=true;
lblMessage.Text="File Size if Over the Limit of " + lMaxFileSize ;
}
}
catch(Exception)//in case of an error
{
lblMessage.Visible = true;
lblMessage.Text="An Error Occured. Please Try Again!";
DeleteFile(sFileDir + sFileName);
}
}
}


Thanks & Regards
Manoj Kumar

Anilkumar431, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response