Results 1 to 4 of 4

Thread: binary picture can't be displayed on web page!

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    12

    Exclamation binary picture can't be displayed on web page!

    The binary picture which was saved in database, can't be dispalyed on the web page. I can see system.byte[] instead of picture!
    code:
    --------
    byte[] byteArray = (byte[]) ReaderObj["Picture"];
    Response.ContentType=ReaderObj["ImageType"].ToString();
    Response.ContentType = "Image/JPEG";
    Response.BinaryWrite(byteArray);
    In your opinion is it a service pack problem or what? As I read this article on this link http://support.microsoft.com/?id=826756 but the pictures which were saved in database are less than 10 kb, really I don't know what to do when the logic is so easy and straight farward!
    please a help, how can I solve this problem!!!!!!!

    Regards,
    Ranine

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: binary picture can't be displayed on web page!

    Are you sure that the data coming out of the database is a valid picture?

    I just did it with a file from my filesystem and it worked no problem:

    VB Code:
    1. System.IO.FileStream fs = new System.IO.FileStream("C:\\Temp\\yes.gif",System.IO.FileMode.Open );
    2.             System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
    3.             byte[] byteArray = new byte[fs.Length];              
    4.             br.Read (byteArray,0,(int)fs.Length);
    5.  
    6.             Response.ContentType = "Image/GIF";
    7.             Response.BinaryWrite(byteArray);

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    12

    Re: binary picture can't be displayed on web page!

    This error has been displayed, but the image file is closed...
    The process cannot access the file "C:\Temp\2003.jpg" because it is being used by another process.?????

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    12

    Re: binary picture can't be displayed on web page!

    the problem has been resolved, to access such file I've added the aspnet account user! but what is saved in database is a valid data, but it is not displayed on web page!
    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width