Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
How can i transfer my file information into binary using a tcp connection from server-client c#

This is my code...
C#
OpenFileDialog fd=new OpenFileDialog();
//fd.Filter = "(*.flv)|*.flv";
byte[] sending_file;

if (DialogResult.OK == fd.ShowDialog())
{
    FileInfo fil = new FileInfo(fd.FileName);   

    textBox5.Text = fd.SafeFileName;
    string filepath =fd.FileName;

    FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.ReadWrite);
    BinaryReader br = new BinaryReader(fs);
    sending_file = br.ReadBytes((int)fs.Length);

    _socket.Send(sending_file);
Posted
Updated 11-Apr-15 21:38pm
v3
Comments
Sergey Alexandrovich Kryukov 11-Apr-15 21:13pm    
Not clear.
—SA

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