468,290 Members | 1,906 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

Using response.addheader for pushing file


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 ..


kindest regards,

Jul 19 '05 #1
0 1848

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Dorsa | last post: by
reply views Thread by brian.fairchild | last post: by
7 posts views Thread by =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post: by
13 posts views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.