Click here to Skip to main content
13,256,260 members (49,419 online)
Click here to Skip to main content
Add your own
alternative version

Stats

63.3K views
930 downloads
23 bookmarked
Posted 13 Feb 2006

Save file on client computer

, 13 Feb 2006
Rate this:
Please Sign up or sign in to vote.
Save file on client computer
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS-->

Title: Save file on client computer
Author: Jitendra Bansiwal
Email: jkbansiwal@hotmail.com
Environmen : ASP

Introduction

This ASP page copy file from web server to client machine without zip the file.

Using the code

Copy the code and save as .asp and open in browser

 Response.buffer = TRUE
 Response.AddHeader "content-disposition","attachment; filename=MyFile.doc"

 Const adTypeBinary = 1
 'Create Stream object
  Dim BinaryStream
 Set BinaryStream = CreateObject("ADODB.Stream")

 'Specify stream type - we want To get binary data.
 BinaryStream.Type = adTypeBinary

 'Open the stream
 BinaryStream.Open

 'Load the file data from disk To stream object
 BinaryStream.LoadFromFile "C:\Abc.doc"

 'Open the stream And get binary data from the object
 dim  BinaryData
 BinaryData = BinaryStream.Read
 Response.BinaryWrite(BinaryData)
Set BinaryStream = Nothing

  Response.End

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jitendra Bansiwal
Web Developer
India India
Around five years of experience in the field of application software development including
Three years of experience in .NET technology.

You may also be interested in...

Comments and Discussions

 
GeneralDebugging for Interdev ASP project in Windows 2003 Server / IIS6 Pin
algor-AG14-Nov-07 3:14
memberalgor-AG14-Nov-07 3:14 
GeneralIt is can not work in HTTPS? please help me Pin
LuckyStar8015524-Jul-07 17:10
memberLuckyStar8015524-Jul-07 17:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171114.1 | Last Updated 14 Feb 2006
Article Copyright 2006 by Jitendra Bansiwal
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid