Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have written a program in c# which records the webcam live video
but I want to save the stream on ftp server as avi.

The api on c# I use for capturing is directx.capture
any ideas ?
Posted
Updated 12-Aug-10 0:57am
v2
Comments
Dalek Dave 12-Aug-10 6:57am    
Minor Edit for Readability.

i neeeeed your own code pleeeeeeaaaaase
of which records the webcam live video
please upload it here or send it to my email
salem.saleh72@yahoo.com
 
Share this answer
 
Here's a small peace of c# code that uploads to ftp from the link source below. You could use it to simply write to using the stream object. Hopefully the connection won't be disconnected before your done uploading. You could give it a try.

public void ftpfile(string ftpfilepath, string inputfilepath)
{
    string ftphost = "127.0.0.1";
    //here correct hostname or IP of the ftp server to be given

    string ftpfullpath = "ftp://" + ftphost + ftpfilepath;
    FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
    ftp.Credentials = new NetworkCredential("userid", "password");
    //userid and password for the ftp server to given

    ftp.KeepAlive = true;
    ftp.UseBinary = true;
    ftp.Method = WebRequestMethods.Ftp.UploadFile;
    FileStream fs = File.OpenRead(inputfilepath);
    byte[] buffer = new byte[fs.Length];
    fs.Read(buffer, 0, buffer.Length);
    fs.Close();
    Stream ftpstream = ftp.GetRequestStream();
    ftpstream.Write(buffer, 0, buffer.Length);
    ftpstream.Close();
}


http://www.logiclabz.com/c/ftp-file-upload-using-ftpwebrequest-in-net-c.aspx[^]

Good luck!
 
Share this answer
 
Comments
Dalek Dave 12-Aug-10 6:57am    
Nice Work!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900