Stream binary to file in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fred80
    New Member
    • Aug 2008
    • 2

    Stream binary to file in C#

    Hello
    This is my first post here :)

    I have a table that hold attachments in binary format. The problem started when i've been asked to write a code that send an email that have all these file as attachments. Am using the System.Net.Mail . It accepts attachment as a string. I tried to stream these file, but i didn't get any results. and, creating a temp doc is not a good solution, since there is no permission for users to write on the server.

    Is there any solution for this problem?

    Thank you
    Fred
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    Welcome to TheS..er, I mean Bytes! You should have posted this over in the .NET forum, as C# is a .NET language. Also, since a mod will likely move this before long, can you post some code so that those who know C# can help?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      And you were not able to use
      System.Net.Mail .Attachment(Str eam, AttachmentName, MediaType) ?

      If your trouble is that you have a byte[], consider using the MemoryStream object.

      Comment

      • fred80
        New Member
        • Aug 2008
        • 2

        #4
        Originally posted by Plater
        And you were not able to use
        System.Net.Mail .Attachment(Str eam, AttachmentName, MediaType) ?

        If you trouble is that you have a byte[], consider using the MemoryStream object.
        I did use that, it says " cant convert string to stream"
        i will try to use the memory stream o bject
        thx

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Originally posted by fred80
          I did use that, it says " cant convert string to stream"
          i will try to use the memory stream o bject
          thx
          Well that makes it sound like you are passing in a string, i thought you had a byte[] from a database?

          Comment

          Working...