Click here to Skip to main content
15,896,539 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
HttpPostedFileBase filel

if (filel != null)
{

    logofilename = Path.GetFileName(filel.FileName);

    logobytes = new byte[filel.ContentLength];

    logoBytestoRead = (int)filel.ContentLength;

    logonumBytesRead = 0;

    while (logoBytestoRead > 0)
    {

        int n = filel.InputStream.Read(logobytes, logoBytestoRead, logonumBytesRead);

        if (n == 0) break;

        logonumBytesRead += n;

        logoBytestoRead -= n;

    }
    objc.CompanyLogo = logobytes;
}
its givng output like{0,0,.....0}
Posted
Updated 27-Nov-15 0:57am
v2

1 solution

You have exchanged the logoBytestoRead and logonumBytesRead variables when passing them to the read function.
logonumBytesRead is the offset which must be passed as second parameter and logoBytestoRead is the number of bytes to read which must be passed as third parameter.

So you are passing zero bytes to read and nothing is read into your buffer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900