Using response.addheader for pushing file

B

Bertrand

Hello,

I am using an ASP form to collect some info from users,
that info is them inserted into an Excel file (copy of a
template that resides on the server .. I use fso.copy to
copy the template first and name according to same
params) ..
I then offer that file for download to the users ... I
first had a link and explained to users that they should
use right-click and then save target as .. however because
I now replaced the link by a button (to allow me to
perform some additional actions - like sending an email),
I would also like to 'push' the file towards the user and
force the download (now, I do know that users will still
always have the coice between download and open ...)

furthermore the problem I am having is just too weird and
I would like someone to explain if possible ...
so ... as said. a template excel file is copied on a
server to a new file still on the server .. the name of
that new file is dynamically created (to avoid writing
over other users files) and after a while, the users
should be able to download it .. when I use the following:

Response.AddHeader "content-disposition","attachment;
filename=""" & server.URLPathEncode(request.form("File"))
& """"

the weirdest thing happens ... the file is tiny & empty
(as in, the single worksheet in there is empty) ..
furthermore, the worksheet is renamed to the name of the
file and the hwole thing is useless of course .. if I
check the server, I do see that the file is present .. so
how come the server/browser (?) chose to transform my file
as it was downloaded .. stripping it of any content and
renaming the worksheet to the file name? ... fyi, the
excel file does cotnain macro's ..

I hope someone can shed some light on this ..

thanks,

kindest regards,

Bertrand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top