Mi è stato detto che occorre modificare il seguente file:
codice:
<table border="0" width="550" cellspacing="0" cellpadding="0" bgcolor="#6699CC">
<tr>
<td width="20">[img]images/angolosx.gif[/img]</td>
<td width="510" align="center"><font size="2" face="Tahoma" color="#F7F7F7">byluciani-thumbs 1.0</font></td>
<td width="20" align="right">[img]images/angolodx.gif[/img]</td>
</tr>
</table>
<table border="0" width="550" cellspacing="0" cellpadding="0" style="border: 1 solid #6699CC">
<form method="POST" enctype="multipart/form-data" action="do_upload.asp">
<tr>
<td width="100%" align="center" bgcolor="#f7f7f7">
<table border="0" width="530" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="3" align="center">
<font size="2" color="#000080">SCRIPT SPERIMENTALE
(ogni suggerimento è gradito)
<p align="justify">
Si possono uploadare solo immagini di tipo ".gif", ".jpg" e ".bmp" non superiori a 100Kb per un totale di 2 immagini alla volta. Inoltre verranno recuperati anche gli ulteriori dati inseriti nel form stesso. Il tutto è stato realizzato in puro ASP/VBScript (senza l'uso di componenti aggiuntivi)</p></font></td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
<td width="270" align="center" valign="top" rowspan="9">
<table border="0" width="240" cellspacing="0" cellpadding="0" style="border: 1 solid #6699CC">
<tr>
<td width="240" align="center" bgcolor="#f7f7f7">
<table width="230" cellpadding="0" cellspacing="0">
<%
set custRs = Server.CreateObject("ADODB.Recordset")
custRs.Fields.Append "nome", 200, 300 ' adVarChar
custRs.Fields.Append "dimensione", 2, 4 ' smallint
custRs.Fields.Append "data", 7 ' Date
custRs.Open
' popolamento
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set f = FileObject.GetFolder(strPath)
For Each f1 in f.Files
custRs.AddNew
custRs("nome") = f1.name
custRs("data") = f1.DateCreated
Next
Set f = Nothing
Set FileObject = Nothing
custRs.Sort = "data DESC"
If Not custRS.EOF AND Not custRS.BOF Then
nomefile = custRs("nome")
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set f = FileObject.getfile(StrPath&"\"&nomefile)
he = ImageHeight(StrPathShort & nomefile)
wi = ImageWidth(StrPathShort & nomefile)
resized = ImageResize(StrPathShort & nomefile, 80, 80, "center")
Response.Write "<tr><td align=""center"">Ultima immagine inserita: " & f.DateCreated & "</td></tr>"
Response.Write "<tr><td align=""center"">" & vbcrlf & "<table width=""100%""><tr><td align=""center""><table cellspacing=""0"" cellpadding=""0"" style=""border: 1 solid #6699CC""><tr><td>" & resized & "</td></tr></table></td></tr><tr><td align=""center"">" & nomefile & "
" & wi & "x" & he & "-" & f.size & "byte</td></tr></table></td></tr>" & vbcrlf
Set f = Nothing
Set FileObject = Nothing
Else
%>
<tr><td align="center">Ultima immagine inserita</td></tr>
<tr><td align="center"></td></tr>
<tr><td align="center">Non ci sono immagini</td></tr>
<tr><td align="center"></td></tr>
<%
End If
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
</tr>
<tr>
<td width="80" align="right"><font size="2" color="#000080">Nome:</font></td>
<td width="180"><input type="text" name="nome" size="20" maxlength="20"></td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
</tr>
<tr>
<td width="80" align="right"><font size="2" color="#000080">Cognome:</font></td>
<td width="180"><input type="text" name="cognome" size="20" maxlength="20"></td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
</tr>
<tr>
<td width="80" align="right"><font size="2" color="#000080">Sesso:</font></td>
<td width="180"><input type="radio" name="sesso" value="0" checked><font size="2" color="#000080">Maschio</font>
<input type="radio" name="sesso" value="1"><font size="2" color="#000080">Donna</font>
</td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="180" align="center"></td>
</tr>
<tr>
<td width="80" align="right"><font size="2" color="#000080">*File 1:</font></td>
<td width="450" colspan="2"><input type="file" name="blob1" size="40"></td>
</tr>
<tr>
<td width="80" align="center"></td>
<td width="450" colspan="2" align="center"></td>
</tr>
<tr>
<td width="80" align="right"><font size="2" color="#000080">*File 2:</font></td>
<td width="450" colspan="2"><input type="file" name="blob2" size="40"></td>
</tr>
<tr>
<td width="80" align="right"></td>
<td width="450" colspan="2"><font size="1" color="#000080">(*) Ammessi: .jpg, .gif, .bmp - Max 100Kb l'uno</font></td>
</tr>
<tr>
<td width="100%" colspan="3" align="center">
<input type="submit" name="enter" value=" Invio ">
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%
Dim objFSO, objFolder, objFile
Set objFSO = server.createobject("scripting.filesystemobject")
Set objFolder = objFSO.getfolder(strpath)
fileMAX = 8
intTotalFiles = objFolder.Files.Count
If objFolder.Files.Count MOD fileMAX = 0 Then
intTotalPages = Int(objFolder.Files.Count/fileMAX)
Else
intTotalPages = Int(objFolder.Files.Count/fileMAX)+1
End If
%>
<table border="0" width="550" cellspacing="0" cellpadding="0" bgcolor="#6699CC">
<tr>
<td width="20">[img]images/angolosx.gif[/img]</td>
<td width="510" align="center"><font size="2" face="Tahoma" color="#F7F7F7">Archivio (Immagini totali: <%=intTotalFiles%>)</font></td>
<td width="20" align="right">[img]images/angolodx.gif[/img]</td>
</tr>
</table>
<table border="0" width="550" cellspacing="0" cellpadding="0" bgcolor="#f7f7f7" style="border: 1 solid #6699CC">
<tr>
<td>
<table width="540" cellspacing="0" cellpadding="0">
<%
If intTotalFiles > 0 Then
col = 0
imagecounter = 1
If Request.QueryString("page").Count > 0 Then
intPageNum = CInt(Request.QueryString("page"))
Else
intPageNum = 1
End If
For Each objFile in objFolder.Files
'Response.Write imagecounter & "-" & (intPageNum*4)-3 & "-" & (intPageNum*4) &"
"
If (imagecounter >= (intPageNum*fileMAX)-(fileMAX-1)) And (imagecounter <= (intPageNum*fileMAX)) Then
col = col + 1
If col = 1 Then Response.Write "<tr>" & vbcrlf
he = ImageHeight(StrPathShort & objfile.name)
wi = ImageWidth(StrPathShort & objfile.name)
resized = ImageResize(StrPathShort & objfile.name, 100, 100, "center")
Response.Write "<td align=""center"" width=""135"">" & vbcrlf & "<table width=""100%""><tr><td align=""center"" height=""110""><table cellspacing=""0"" cellpadding=""0"" style=""border: 1 solid #6699CC""><tr><td>" & resized & "</td></tr></table></td></tr><tr><td align=""center"">" & objfile.name & "
" & wi & "x" & he & "
" & objfile.size & "byte
" & objFile.DateCreated & "</td></tr></table>
" & vbcrlf & "</td>" & vbcrlf
If col = 4 Then
Response.Write "</tr>" & vbcrlf
col = 0
End If
'If col > 4 Then col = 1
End If
imagecounter = imagecounter + 1
'If imagecounter > fileMAX Then Exit For
Next
If col > 0 AND col < 4 Then
For colonne = col+1 To 4
Response.Write "<td width=""135""></td>" & vbcrlf
Next
Response.Write "</tr>" & vbcrlf
End If
Else
%>
<tr><td align="center"></td></tr>
<tr><td align="center">Non ci sono immagini</td></tr>
<tr><td align="center"></td></tr>
<%
End If
%>
</table>
</td>
</tr>
<tr>
<td align=center>
<table width="80%" cellspacing="0" cellpadding="0">
<tr><td colspan="3" align="center"><font face=Tahoma size=2 color="#000080">Pagina <%=intPageNum%> di <%=intTotalPages%></font></td></tr>
<tr><td colspan="3" align="center"></td></tr>
<tr><td width="33%">
<%
If intPageNum > 1 Then
Response.Write("« Precedente ")
End If
%>
</td>
<form method="get" action="default.asp" name="paginazione">
<td width="34%" align="center"><font face=Tahoma size=2 color="#000080">
Vai a pagina </font><select name="page" onchange="javascript:paginazione.submit()">
<%
For ll = 1 to intTotalPages
%>
<option value="<%=ll%>"<%If ll=intPageNum Then Response.Write " selected"%>><%=ll%></option>
<%
Next
%>
</select>
</td>
</form>
<td width="33%" align="right">
<%
If intPageNum < intTotalPages Then
Response.Write(" Seguente »")
End If
%>
</td></tr>
</table>
</td>
</tr>
</table>
<%
set objfolder = Nothing
set objfso = nothing
%>
il codice è impostato per leggere direttamente la cartella contenente le immagini con il filesystemobject e di conseguenza le recuperi ordinate per nome
altrimenti devi caricare le informazioni recuperate con il fso in un recordset con questo codice
codice:
<%
set custRs = Server.CreateObject("ADODB.Recordset")
custRs.Fields.Append "nome", 200, 300 ' adVarChar
custRs.Fields.Append "dimensione", 2, 4 ' smallint
custRs.Fields.Append "data", 7 ' Date
custRs.Open
' popolamento
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
StrPath = Server.MapPath("\public\upload")
Set f = FileObject.GetFolder(strPath)
For Each f1 in f.Files
custRs.AddNew
custRs("nome") = f1.name
custRs("data") = f1.DateCreated
Next
Set f = Nothing
Set FileObject = Nothing
%>
e ordinarle a piacere con
<%
custRs.Sort = "data DESC"
%>
ma non so come fare.
Qualcuno sa aiutarmi?
Grazie