Reputation: 0 Apprentice
- New Members
- Active Posts:
- 16 (0.03 per day)
- 05-October 12
- Profile Views:
- Last Active:
- Nov 21 2012 03:50 PM
- Dream Kudos:
Posts I've Made
Posted 5 Oct 2012If you pass the stream directly to the function, it will get the exact data that was uploaded. (It is the StreamReader class that does decoding of the bytes to figure out any Unicode/Multibyte that needs any special treatment.)
so you are saying i should directly pass the below stream to my function ???
stream = FileUpload1.content;
no need of all conversions from string to stream ???
Posted 5 Oct 2012Have you done a hex dump of the stream data or are you just looking at the data in notepad or in a message box or HTML renderer? Notepad tends to hide whether a file in Unicode or ANSI unless you really dig. The message box gives you no clue whether the string is on format or another originally bceause what gets displayed on screen will be Unicode. And the HTML that is rendered is sent back down as UTF-8 encoded, is it may have round tripped from ASCII to Unicode to UTF-8.
1. By above string conversion and generating stream. I am passing this stream to the function.
2. the function accepts only stream.
3. If I pass the stream in this way do you think it will work i.e the function will get exactly the contents of uploaded file.
Posted 5 Oct 2012You already have a stream in FileUpload1.FileContent. Why do you need to convert it to a stream?
If your intent was to convert ASCII data that was uploaded into Unicode, you can simply create one StreamReader with the ASCII encoding (http://msdn.microsoft.com/en-us/library/ms143456.aspx), and a StreamWriter with the Unicode encoding (http://msdn.microsoft.com/en-us/library/3aadshsx.aspx). Then you can read and write a line at a time instead of allocating two huge memory streams.
I used stream = FileUpload1.FileContent
then when I have written that stream to response.stream to check the output
(uploaded file should be same as the above stream i get the output as--- System.Web.HttpInputStream in file)
but if I am converting in to string with all the above conversions, and then I download the stream the content of the stream is same as the file uploaded
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
sameer1988 hasn't added any friends yet.