Downloading a mdb file.

Y

Yan Roosens

Hi all,

I try to download a mdb file. If I simply display a link to the file,
the right-click/Save Target As doesn't work.
I couild rename the mdb file into a zip file, I think the download would
work, but the user would have to rename the zip file into a mdb file,
and I try to avoid this.

Here is the code I have so far:

<%
Response.ContentType = "text/plain"
Response.AddHeader "Content-Transfer-Encoding", "binary;"
Response.AddHeader "Content-Disposition", "attachment;
filename=backup.mdb;"

thepath = server.mappath("/") & "\test\backup.mdb"

Set fsob = Server.CreateObject("Scripting.FileSystemObject")
set thefile = fsob.OpenTextFile(thepath)
response.BinaryWrite(thefile.ReadAll)

set fsob = Nothing
set thefile = Nothing
%>

The file is downloaded and saved on the local HD, but it is corrupted
and I can't open it with Access.
The mdb file on the server is 2,7 Mb and the locally saved file is 5,3
Mb.

I don't know exactly where is the problem. In the ContentType, in the
Encoding?
Or maybe the problem is in the OpenTextFile? Not the right way to open a
mdb file?

Does anybody know how to fix this code?

TIA
Yan
 
S

Slim

Yan Roosens said:
Hi all,

I try to download a mdb file. If I simply display a link to the file,
the right-click/Save Target As doesn't work.


it works when i try it
 
B

Bullschmidt

Right-click/Save Target As on a regular link to an .mdb file should
work.

Best regards,
J. Paul Schmidt, Freelance ASP Web Consultant
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Y

Yan Roosens

Hi Paul,
Right-click/Save Target As on a regular link to an .mdb file should
work.

It should....but it doesn't.
Could it be because Access is not installed on the client?

I have tried with a text file and jpg file, it works as expected.

Thank you for the response.
Yan
 
D

dlbjr

If you have a web page with a link to it then it can be downloaded.
The referrer will allow it. No referrer = no download.

Example htm page:

<a href="data.mdb">Download database file</a>

'dlbjr

'Unambit from meager knowledge of inane others,engender uncharted sagacity.
 
Y

Yan Roosens

Hello,
Right-click/Save Target As on a regular link to an .mdb file should
work.

I have tried to download from a client with Access installed, and it
doesn't work.
So the problem is on the server. I will post in a IIS related news
group.

Thank you anyway.
Yan
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top