CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Location
    Gods own country, India
    Posts
    248

    Arrow Writing binary files in server [ASP]

    Hello All,

    I got a code snippet for writing binary files in (iis) server.
    Code:
    Function SaveBinaryData(FileName, ByteArray)
    
      Dim BinaryStream
      Set BinaryStream = CreateObject("ADODB.Stream")
    
      BinaryStream.Type = 1
      
      BinaryStream.Open
      BinaryStream.Write ByteArray
    
      BinaryStream.SaveToFile FileName, 2
    End Function
    
    filename = request.querystring("filename")
    root = Server.MapPath("/test")
    
    Response.write( root & "/" & filename)
    SaveBinaryData  root & "/" & filename,"ddddddddd"
    But this throws error "ADODB.Stream (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another." at the highlighted line.

    a search didn't gave much information

    any help would be appreciated.
    thanks

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Writing binary files in server [ASP]

    If you are using ASP, that means you are attempting to do this at the server-side. So how come you haven't declared the server for the created object?

    Code:
    Set BinaryStream = Server.CreateObject("ADODB.Stream")
    EDIT: And is this where you got the example?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Dec 2003
    Location
    Gods own country, India
    Posts
    248

    Re: Writing binary files in server [ASP]

    Quote Originally Posted by PeejAvery
    If you are using ASP, that means you are attempting to do this at the server-side. So how come you haven't declared the server for the created object?

    Code:
    Set BinaryStream = Server.CreateObject("ADODB.Stream")
    err.. my mistake.. added it.. still error persists.

    EDIT: And is this where you got the example?
    yes

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Writing binary files in server [ASP]

    That's because you are passing the string "ddddddddd" to a parameter that wants a ByteArray. You probably should be working with the second example on that webpage.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

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

Featured