System.IO.Stream myStream;
Int32 fileLen;
Stream myStream1 = new MemoryStream();
// Get the length of the file.
fileLen = FileUpload1.PostedFile.ContentLength;
// Create a byte array to hold the contents of the file.
Byte[] Input = new Byte[fileLen];
UnicodeEncoding uniEncoding = new UnicodeEncoding();
// Initialize the stream to read the uploaded file.
myStream = FileUpload1.FileContent;
// Read the file into the byte array.
myStream.Read(Input, 0, fileLen);
string value = ASCIIEncoding.ASCII.GetString(Input);
using (StreamWriter sw = new StreamWriter(myStream1, uniEncoding))
{
sw.Write(value);
}
//MyStream1 will be final output
1 Replies - 117 Views - Last Post: 05 October 2012 - 01:03 PM
#1
convert uploaded file into stream...is this right way ?
Posted 05 October 2012 - 12:44 PM
Replies To: convert uploaded file into stream...is this right way ?
#2
Re: convert uploaded file into stream...is this right way ?
Posted 05 October 2012 - 01:03 PM
Closing this thread in favor for the other thread that was moved into the C# forum.
Page 1 of 1
|
|

New Topic/Question
This topic is locked



MultiQuote




|