Ik heb het volgende script geschreven om een download te forceren zodat een PDF niet standaard in je browser wordt geopend maar je de optie hebt om 'm te save as...
Ik zie iets over het hoofd waardoor ie in IE niet werkt. In Firefox werkt ie prima.
Ik zie iets over het hoofd waardoor ie in IE niet werkt. In Firefox werkt ie prima.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| <%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="../db/connect.asp" -->
<%
Dim strFileName
Dim strDate
Dim strQuery
strFileName = Request.QueryString("filename")
strDonwload = Request.QueryString("download")
strDate = right(cStr(day(date)+100),2) & "-" & right(cStr(month(date)+100),2) & "-" & year(date) & " " & right(cStr(hour(now)+100),2) & ":" & right(cStr(minute(now)+100),2)
If Session("vendor") = 1 Then
strDate = strDate & " Leverancier"
End If
If strDownload = 1 Then
' db connection
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strConnectionString
' mark the file as downloaded
strQuery = "UPDATE files SET date_downloaded='" & strDate & "' WHERE filename='" & strFileName & "' AND project_id=" & Session("project_id")
objConn.Execute(strQuery)
objConn.Close
Set objConn = nothing
End If
Response.ContentType = "application/asp-unknown"
Response.AddHeader "content-disposition","attachment; filename=" & strFileName
Set FStream = Server.CreateObject("ADODB.Stream")
FStream.Open()
FStream.Type = 1
FStream.LoadFromFile(filePath&filename)
Response.BinaryWrite FStream.Read()
FStream.Close
Set FStream = Nothing
Response.End
%> |