locked
ASHX is only rendering part of image RRS feed

  • Question

  • User1478621313 posted

    I am writing some images to the database and trying to pull them out for displaying.

    I can sucessfully upload a 1MB file and display that properly. I can upload a 2.8MB file but when I try to display it..only about a third of it displays and the rest is cut off.

     

    The data type is image. Here is the code of the ASHX file.

     

    public void ProcessRequest (HttpContext context) {
            try
            {
                MiscServices ms = new MiscServices();
                SybaseDataReader Reader = ms.GetImage();
                ms = null;

                if (Reader.HasRows == true)
                {
                    while (Reader.Read())
                    {
                        // Clear all content output from the buffer stream
                        byte[] byteArray = (byte[])Reader["file_data"];
                        context.Response.ContentType = Reader["file_type"].ToString();
                        context.Response.BinaryWrite(byteArray);
                    }
                }
                else
                {
                    // tbd
                }

                Reader.Close();
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }

     

    Any reasons what would cause this image to be cut off? Im totally stumped on this one.

     

    Thanks in advance. 

     

     

    Tuesday, February 20, 2007 6:32 PM

Answers

  • User1478621313 posted

    problem solved. I specified in the connection string the size allowed text to 10MB and this cleared it up.

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 21, 2007 2:02 PM