how to pass a file from openfiledialog to stream reader

Posted by Anishabathija under C# on 12/12/2012 | Points: 10 | Views : 1526 | Status : [Member] | Replies : 1
hey ,

I have a windows application , in which I have a openfiledialog to browse a file , Could you help me with a code to pass this file into my stream reader.


Posted by: Sandeepmhatre on: 12/19/2012 [Member] Starter | Points: 25

Refer last part of this code

int fileSize = fpControl.PostedFile.ContentLength;
Stream fs = fpControl.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
//Create array and read the file into it
//fpControl.PostedFile.InputStream.Read(bytes, 0, fileSize);
UploadProofPage oUploadProofPage = new UploadProofPage();
oUploadProofPage.UPLOAD_IdProof = bytes;
oUploadProofPage.UploadId = UploadID;
oUploadProofPage.FileName = fileName;
oUploadProofPage.ContentType = documentType;
if (oUploadProofPage.UpdateFilePosted())

Sandeep M,
Software Developer
Follow me on :

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

Login to post response