Please provide us with the URL of your script so that we can call it and examine its output. If you are not comfortable doing so on this forum, you can email the URL directly to
support@foxweb.com. At the same time, please email us the original DBF file, so that we can compare it with the output of your script.
FoxWeb Support Team
support@foxweb.com
Sent by angelin on 04/17/2002 02:50:01 AM:
I tried,but failed.It still display the error message.I want to download the dbf file automatically,you give me a suggestion to compress all necessary files together in a single zip file before sending them to the browser. i think it is not perfect to me.I use the chinese versions of win2k.I don't know if it caused the error.
Sent by FoxWeb Support on 04/16/2002 08:30:25 PM:
Apparently VFP cannot directly open files downloaded from the Internet even if you use the correct content type (Visual.FoxPro.Table). The error message returned by VFP is: "File access is denied."
The best solution is to force IE to save the results to a file and then open it manually. Please try the following code.
<% SELECT cust_no,cust_name,tel FROM customer INTO CURSOR results * Save the data to a temporary file
M.TempFileName = ADDBS(SYS(2023)) + SYS(3) + LTRIM(STR(Request.CurrentChannel)) + ".DBF" COPY TO (M.TempFileName) * Read the temp file
M.FileContent = FILETOSTR(M.TempFileName) DELETE FILE M.TempFileName M.FileName ="results.dbf" * Send the file to the browser
Response.Buffer = .T. Response.AddHeader("Content-Disposition", "attachment; filename=" + M.FileName) Response.AddHeader("Content-Length", Server.ToString(LEN(M.FileContent))) Response.ContentType = 'application/unknown' Response.Write(M.FileContent) %> |
Note this code will not work with DBF files with memo fields or index tags, because in such cases you will also need to download the FPT and/or CDX files. A good solution to avoid this problem is to compress all necessary files together in a single zip file before sending them to the browser.
FoxWeb Support Team
support@foxweb.com
Sent by angelin on 04/16/2002 01:32:11 AM:
I download dbf file use code as below:
select cust_no,cust_name,tel from customer into cursor results
copy to file/results.dbf
response.buffer = .t.
filename ="results.dbf"
fileextension = upper(justext(filename))
if file(filename) and fileextension == "DBF"
contenttype = "application/Microsoft Visual FoxPro"
response.addheader("content-disposition", "inline; filename=" +filename)
filecontent = readfile(filename)
response.addheader("content-length", server.tostring(len(filecontent)))
response.contenttype = contenttype
response.write(filecontent)
response.end
endif
every time I open the dbf file be downloaded ,the system always displays the message 'it's not a table'. I don't know how to solve it.please give me suggestion.
thanks.