Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 527
  • Last Modified:

Create Binary file in ASP

How can I create a binary file and write binary content to a file in ASP?

Thnak ahead.

1 Solution

This is a little bit hard, but you can see example,

Wee Siong
'Create an instance of the FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Create the object and the binary file to write to
Set objBinaryFile = objFSO.CreateTextFile(Server.MapPath("outputfile.ext"))
'Write the information to the file
objBinaryFile.Write binInformation
'Close the file
'Clean up
Set objFSO = Nothing

Should note that you should change the outputfile.ext to whatever filename you want and should change the binInformation variable to whatever variable name your binary information is stored in.

Hope this helps.
Michel SakrCommented:
If you have a binary stream.. create the file using fso.. you can open the file as

set objBinaryFile = Server.CreateObject("BinaryFileStream.Object")
Response.BinaryWrite objBinaryFile.GetFileBytes(CStr(strFileName))
set objBinaryFile = nothing

BinaryFileStream object dll can be found here:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now