write Request.InputStream into a txt file.
Request.InputStream return the type of System.IO.Stream, so we can write the data into a file.
Coding as follow:
string StrFileName="c:\\1.txt";
System.IO.FileStream fs = new System.IO.FileStream(StrFileName,System.IO.FileMode.Create);
System.IO.Stream ns=Request.InputStream;
byte[] nbytes = new byte[512];
int nReadSize=0;
nReadSize=ns.Read(nbytes,0,512);
while( nReadSize >0)
{
fs.Write(nbytes,0,nReadSize);
nReadSize=ns.Read(nbytes,0,512);
}
fs.Close();
ns.Close();
Coding as follow:
string StrFileName="c:\\1.txt";
System.IO.FileStream fs = new System.IO.FileStream(StrFileName,System.IO.FileMode.Create);
System.IO.Stream ns=Request.InputStream;
byte[] nbytes = new byte[512];
int nReadSize=0;
nReadSize=ns.Read(nbytes,0,512);
while( nReadSize >0)
{
fs.Write(nbytes,0,nReadSize);
nReadSize=ns.Read(nbytes,0,512);
}
fs.Close();
ns.Close();