Skip to content Skip to sidebar Skip to footer

Convert File Received From Jquery To Byte Array

I need help in converting a file received from a jquery ajax to byte array. I'm using a plugin called ajaxfileupload then from a jquery ajax call I send a file from a fileupload c

Solution 1:

Just these 3 lines will do:

    int filelength = file.ContentLength;
    byte[] imagebytes = new byte[filelength ];
    file.InputStream.Read(imagebytes , 0, filelength );

Solution 2:

using (var stream = upload.InputStream)
{
    // use stream here: using StreamReader, StreamWriter, etc.
}

Post a Comment for "Convert File Received From Jquery To Byte Array"