Areas > Languages > VBScript
Areas > ASP / ASP.Net > Functions
Areas > ASP / ASP.Net > File & data transfer
Areas > WSH
to read and write files, because these languages were designed as
"safe" client-side programming languages. Denied access to file system is it's
1. ADODB.Stream object
ADODB.Stream is a first object you can use to read/write text and binary files. The object is included in ADO 2.5 and later.
ADODB.Stream let's you also save text data and let's you specify charset (codepage) for text-to-binary data conversion (against of Scripting.TextStream object).
2. Scripting.FileSystemObject object
You can also use TextStream object from Scripting library to store binary data. This function may be useable on servers without ADO installed. This function uses BinaryToString from Convert a binary data (BinaryRead) to a string by VBS article.
3. WinHttpRequest (XMLHTTP, ServerXMLHTTP) and remote files.
Microsoft created several
objects, which let's
you read remote binary and text
files. First of them was Microsoft.XMLHTTP - the object is using WinINET API,
so there is no good idea to use it on server-side ASP script. Thanks to WinINET
API, XMLHTTP has a great functionality - it supports any URL - http, https,
ftp and gopher. The URL looks like protocol://usename:password@server/folder/file?parameters.
You can use ResponseText property to get the document data as a string (or BinaryToString VBS function).
for 'Work with binary files in VBSscript - read and write local and remote files' articleDownload multiple files in one http requestThis article shows a way to download multiple files in one http request. It let's you send an HTML page along with image preview, prepare more files for download and send the files as one data stream. One request, one authentication per multiple files.
Read and write SQL image data, store binary file to sql table.Store and read SQL image/binary data using functions in this article. You can store local or remote files in an sql table along with a description and other fields.
Post binary data to URL from WSH/ASP/VBA/VBScript.Two methods to POST binary or string data to external URL and read results sent from a script on the URL.
Convert a binary data (BinaryRead) to a string by VBSThis article, demonstrates several versions of source VBS code you can use to work with binary data in ASP and convert the data to a String format.
Create and work with binary data in ASP/VBScriptLets you convert/create binary data in ASP to use the data for BinaryWrite/BinaryRead.
Write to text file from MS-SQL.Stored procedure which enables write text data directly to the file.
Copyright and use this code
The source code on this page and other samples at http://www.motobit.com/tips/ are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
2. Link this sample from you page.
<A Href="http://www.motobit.com/tips/detpg_read-write-binary-files/" Title="Reading and writting binary and text files is a first task you will need to solve in server-side ASP. This article contains several VBS functions which let's you store data to local disk and read local or remote (http) files." >Work with binary files in VBSscript - read and write local and remote files</A>
© 1996 - 2012 Antonin Foller, Motobit Software | About, Contacts | e-mail: email@example.com
Partner sites: Search Czech Last minute Zajezdy Obsah na mobil Hry na mobil Java Hry Print-shop Affiliate programy
Kurzy: Akcie | Urad prace | Zakony | Zlato | Firmy | Dane
|IISTracer - IIS ISAPI real-time monitor IISTracer is a real-time monitoring tool for Microsoft IIS, which will show/log you what is happenning on IIS server right now. It let's you reveal problems with long-running scripts (.asp, .cgi, cfm...), hang-up states and low resource situations and lets you stop long-running requests (uploads/downloads).||ActiveX User account Manager - Set of simple objects for creating, deleting, and managing user accounts, groups, servers and domains in the Windows NT environment.|
|Active log file - Hi-performance text file logging for ASP/VBS/VBA applications. Lets you create daily/weekly/monthly log files with variable number of logged values and extra timing and performance info.||ActiveX windows registry editor - Intuitive, easy to use COM interface to windows registry. Set of classes to read/enumerate/modify windows registry keys and values from ASP, VBS and T-SQL.|
|ActiveX/ASP Multi Dictionary object - Free-threaded hi-speed dictionary algorithm with unique/nonunique keys (map/multimap). Connect to another dictionary object in the same process. Lock and Unlock methods to synchronize tasks (application scope). Share ASP Application/Session objects.||Export DBF/MDB from ASP - Conversion from recordset to MDB/DBF. Direct binary output of MDB or DBF files from ASP pages with one row of code.|
|Pure-ASP upload - lets you upload files using Pure ASP VBS code (using multipart/form-data and input type=file).||ByteArray - Works with safearray binary data (VT_UI1 | VT_ARRAY) - save/restore binary data from disk, find, work with code pages, convert to string/hexstring(SQL).|
|WebChecker - Checks http, https, ftp and gopher internet connections in regular intervals. Lets you monitor web site functionality (uptime). Enables restart or notification on problems.||HTTPLog ISAPI filter - Lets you log incomming/outgoing http header and document data to separate files. Monitor of IIS service input/output.|