Hi,
I would like to add a counter at my Home Page to know how many times a file was downloaded.
How to do this or where can I find it?
Thanks a lot...
Michel Jr.
Printable View
Hi,
I would like to add a counter at my Home Page to know how many times a file was downloaded.
How to do this or where can I find it?
Thanks a lot...
Michel Jr.
I may be wrong but I think some ISPs provide this service.
Alternatively you could write an Active Server Page which logs each time the file is downloaded
OK i've just knocked this up. It needs polishing up a bit.
database dload.mdb has a table called table1 with two fields in it
Filename and count
count is Number data type.
Code:<%@ Language=VBScript %>
<!--
Written by Mark Sreeves
-->
<BODY>
<%
dim Fname
dim conn
dim rst
Fname = request("Filename")
if Fname <> "" then
'open the connection to the database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\dload.mdb")
strSQL = "Update Table1 set count = count+1 where filename='" & Fname & "';"
conn.execute strsql
response.write "<SCRIPT LANGUAGE='JavaScript'>" & vbcrlf
response.write "window.location='" & Fname & "';" & vbcrlf
response.write "</SCRIPT>"
end if
%>
<form name="frm1"action="download.asp">
<A HREF="javascript:document.frm1.submit()">Download Myfile.zip</A>
<input name="Filename" type="hidden" value="Myfile.zip">
</form>
</BODY>
</HTML>