sameer1988's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
16 (0.02 per day)
Joined:
05-October 12
Profile Views:
329
Last Active:
User is offline Nov 21 2012 03:50 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   sameer1988 has not set their status

Posts I've Made

  1. In Topic: Convert uploaded file into stream...is this right way?

    Posted 5 Oct 2012

    View PostSkydiver, on 05 October 2012 - 03:18 PM, said:

    If 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 ???

    for example:
    stream = FileUpload1.content;
    function xyz(stream);

    no need of all conversions from string to stream ???
  2. In Topic: Convert uploaded file into stream...is this right way?

    Posted 5 Oct 2012

    View PostSkydiver, on 05 October 2012 - 02:30 PM, said:

    Have 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.
  3. In Topic: Convert uploaded file into stream...is this right way?

    Posted 5 Oct 2012

    View PostSkydiver, on 05 October 2012 - 01:01 PM, said:

    You 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

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

sameer1988 hasn't added any friends yet.

Comments

sameer1988 has no profile comments yet. Why not say hello?