Take the 2-minute tour ×

I am using jquery $.post function to just call an asp script. This script needs to copy a file I have on the server and save it on the clients machine. I would like for the user to use the typical save window to save the file where they want instead of hardcoding a path in the asp. Any suggesitons?

This is the asp I have:

    'Name of finished file
ImageFile = "sampleXML.xml"

'Destination of finsished file
DestFolder = ""

'Download address of file
URL = "http://localhost/MyWeb/sampleXML.xml"

Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", URL, False

set oStream = createobject("Adodb.Stream")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1 

oStream.type = adTypeBinary
oStream.write xml.responseBody

' Use this form to overwrite a file if it already exists
oStream.savetofile DestFolder & ImageFile, adSaveCreateOverWrite


set oStream = nothing
Set xml = Nothing


and the jquery:

$("#sampleXML").click(function () {

Thank you

share|improve this question
You need open it in a new tab or window and correctly set the content type of the returning document in the header. That will trigger a save dialog. –  Archer May 1 '13 at 13:51
add comment

2 Answers

up vote 0 down vote accepted

Figured it out. Finally found a useful page for asp classic.


share|improve this answer
add comment

You should not need to do this. It is a standard feature that a popup window opens to ask to download or save. There is no way to change these options because doing so could expose visitors to exploits.

share|improve this answer
add comment

Your Answer


