Results 1 to 2 of 2

Thread: converting Byte array to a string

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    converting Byte array to a string

    I'm using this code to view a .PDF that is stroed in a DB:

    Code:
      Response.ContentType = "application/octet-stream"
                ' let the browser know the file name
                Response.AddHeader("Content-Disposition", "attachment;filename=" & Trim(pdf))
                ' let the browser know the file size
                Response.AddHeader("Content-Length", strFileName)
                Response.BinaryWrite(objDR("bid_document"))
    but I'm having trouble getting the filesize in the Response.AddHeader("Content-Length", strFileName)
    the only way I can get the file size is objDR("pdfFile") but then I can't place that value in there becasue you can't convert Byte() array to a string...any suggestions on how I can get the file size? If I put it in manually it works fine...

  2. #2
    Junior Member
    Join Date
    Nov 2002
    Location
    Left past the postbox
    Posts
    30

    Reply

    Hi,


    To do this use the System.Text.Encoding.GetString
    method.

    Here is an example:

    Code:
    dim encode as System.Text.Encoding
    
    
    encode.GetString(bytearrayhere)
    This should work although I havent put it into a test app yet.
    Never hit a man with glasses, hit him with a baseball bat instead.

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