473,378 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Downloading a mdb file.

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

Jul 19 '05 #1
5 2905

"Yan Roosens" <ya*********@skynet.be> wrote in message
news:40***************@skynet.be...
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

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

Jul 19 '05 #2
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!
Jul 19 '05 #3
Hi Paul,

Bullschmidt wrote:
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

Jul 19 '05 #4
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.
Jul 19 '05 #5
Hello,

Bullschmidt wrote:
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

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
3
by: Jocelyn Duhaylungsod | last post by:
I have been getting the following server errors sporadically while downloading excel, csv or xml file. Internet Explorer cannot download <file name> from <IP address> "The server returned an...
4
by: Richard L Rosenheim | last post by:
I know that I can download a file from a web server by using the WebClient.DownloadFile method. But, does anyone know of an example of downloading a file from a web server with the ability to...
4
by: Jeremy Chapman | last post by:
I have build a web page that lists files in a database. When the user clicks on the file the page streams the file contents to the browser with code like:...
7
by: Frank | last post by:
Hi, On one of my server, downloading file by clicking a button give empt file. On the other servers work perfectly. Is any idea ? What should be change in IIS Metabase setting? After click the...
2
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code...
5
by: roland.groenvynck | last post by:
I try to build my first web form application with C#. I want to program the downloading of a file to the client . Therefore I can use WebClient.DownloadFile (url, filepath ); I would like that...
4
by: M. Noroozi Eghbali | last post by:
Hi, I need to download a file using OnClick event or Command of a ASP button. Is there any possible code for this? In ASPX file: <ASP:Button id="button1" runat="server" text="Start...
7
by: raids51 | last post by:
Hello, i have a program that downloads a file using the httpwebrequest/response, and it usually works, but sometimes it will freeze at a random part of the download without an error. here is the...
1
by: Bryan729 | last post by:
Hi, I created a public folder which were I upload my actual files and a database table named "file" which I put and stored the path for my actual files, I was wondering if there's a code for...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.