B4J Question count downloads files

delozoya

Member
Licensed User
Longtime User
i have this code:

B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
    mreq = req
    mresp = resp
    Dim start As Long = DateTime.Now
    resp.ContentType = "text/html"

'    resp.Write("<a href='/'>Back</a>")
    resp.Write("<HTML><HEAD><LINK HREF=""jetty-dir.css"" REL=""stylesheet"" Type=""text/css""/><TITLE>NuclearSlim</TITLE></HEAD><BODY align=""center"" bgcolor=""#000000"">")
    'resp.Write("<H1>Directory: /ROM/</H1>")
    resp.Write("<script language=""javascript""> var i =0; function contador() { i=i+1; var a = document.getElementById(""b""); a.value = ""Presiona Aqui ("" + i + "")""; } </script>")
   
   
   
   
    resp.Write("<a href=""http://62.43.193.254:8888/""><img align=""center"" src='images/logo_nuclear.jpg'/ width=500 height=300>")
    resp.Write("<h1 align=""left"" style=""font-size:450%""><font  color=""ffffff"">DESCARGAS</h1>")
    resp.Write("<TABLE BORDER=0>")
    'resp.Write("<TR><TD><A HREF=""/ROM/../"">Parent Directory</A></TD><TD></TD><TD></TD></TR>")
Dim list As List
Dim d As Long

list=File.ListFiles("www/ROM")
If list.Size=0 Then
resp.Write("<TR><TD style=""font-size:150%"" ><ALIGN=right ><font color=""ffffff"" >  Noy hay ficheros</TD></font></TR>")

Else
For i=0 To list.Size-1
    Log(list.Get(i))
    d=File.LastModified("www/ROM",list.Get(i))

resp.Write("<TR><TD><A style=""font-size:200%"" HREF=""/ROM/"&list.Get(i)&""">"&list.Get(i)&"</A></TD><TD style=""font-size:150%"" ><ALIGN=right ><font color=""ffffff"" >  228143695 bytes&nbsp;</TD></font><TD style=""font-size:150%""><font color=""ffffff"" >"&DateTime.Date(d)&"-"&DateTime.Time(d)&"</TD></font></TR>")

Next

Log("<A HREF=""/ROM/"&list.Get(0)&">"&list.Get(0)&"</A><BR>")

End If
resp.Write("</TABLE>")




End Sub

And i would like create a count for this

B4X:
resp.Write("<TR><TD style=""font-size:150%"" ><ALIGN=right ><font color=""ffffff"" >  Noy hay ficheros</TD></font></TR>")
 

delozoya

Member
Licensed User
Longtime User
Sorry I Sent wrong code, U need count the number of downloads of the file in folder www/ROM


B4X:
resp.Write("<TR><TD><A style=""font-size:200%"" HREF=""/ROM/"&list.Get(i)&""">"&list.Get(i)&"</A></TD><TD style=""font-size:150%"" ><ALIGN=right ><font color=""ffffff"" >  228143695 bytes&nbsp;</TD></font><TD style=""font-size:150%""><font color=""ffffff"" >"&DateTime.Date(d)&"-"&DateTime.Time(d)&"</TD></font></TR>")
 
Upvote 0
Top