Ho provato a fare questo:
codice:
<%
Dim objFso, objFolder, objFiles
Dim strFolder, strFile, strPath, strExt
' Definisci il percorso della cartella da leggere
strPath = "/FOTO"
strExt = ".JPG"
Set objFso = Server.createObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder(Server.MapPath(strPath))
Set objFiles = objFolder.Files
dim iContatore
dim displayPulsanti
iContatore = 0
displayPulsanti = true
foto =split(rs.fields("foto"), ", ")
For i = 0 to UBOUND(foto)
next
for each strFile in objFiles
if Right(lcase(strFile.name), Len(strExt)) = lcase(strExt) then
iContatore = iContatore + 1
end if
next
if iContatore <= 1 then
displayPulsanti = false
end if
iContatore = 0
for each strFile in objFiles
if Right(lcase(strFile.name), Len(strExt)) = lcase(strExt) then
%>
<tr>
<td bgcolor="#FFFFFF" width="86">
<p align="center">
<a href="../ordini/<%=Response.Write(strFile.name)%>" rel="lightbox"><img border="0" src="<%=Response.Write(strFile.name)%>"></a></td>
<input type="hidden" name="foto" size="31" value="<%=Response.Write(strFile.name)%>">
<td bgcolor="#FFFFFF" width="122" align="center">
<script language="javascript" type="text/javascript">
window.onkeypress = setInterval('changeTotale<%=iContatore%>()',100);
function changeTotale<%=iContatore%>(){
if (document.getElementById('box<%=iContatore%>').style.display=="none") {
var quantita = document.getElementById('quantita<%=iContatore%>').value;
var ta = document.getElementById('formato<%=iContatore%>').value;
if(quantita>=40){
var tita = ta.replace('10X15|0.20','10X15|0.15').replace('12X16|0.20','12X16|0.18').replace('13X18|0.25','13X18|0.20');
} else {
var tita = document.getElementById('formato<%=iContatore%>').value;
}
var ris = tita.split("|")[1];
var num = parseFloat(ris)*parseFloat(document.getElementById('quantita<%=iContatore%>').value);
} else {
var num = parseFloat(document.getElementById('formatos<%=iContatore%>').value.split("|")[1])*parseFloat(document.getElementById('quantita<%=iContatore%>').value);
}
if(num>=0)
var quantita = document.getElementById('quantita<%=iContatore%>').value;
if(quantita == ""){
var num = 0 ;
var importo = num.toFixed(2);
var importos = importo.replace('.',',');
document.getElementById('risultato<%=iContatore%>').innerHTML = importo;
document.getElementById('risultatob<%=iContatore%>').value = importo;
} else {
var importo = num.toFixed(2);
var importos = importo.replace('.',',');
document.getElementById('risultato<%=iContatore%>').innerHTML = importo;
document.getElementById('risultatob<%=iContatore%>').value = importo;
}
}
</script>
<% format = formato(i) %>
<div id="boxa<%=iContatore%>">
<select size="1" name="formato" id="formato<%=iContatore%>" onchange="changeTotale<%=iContatore%>()">
<option value="10X15|0.20" <%if format = "10X15" then%> selected="selected"<%end if%>>10x15</option>
<option value="12X16|0.20" <%if format = "12X16" then%> selected="selected"<%end if%>>12x16</option>
<option value="13X18|0.25" <%if format = "13X18" then%> selected="selected"<%end if%>>13x18</option>
<option value="15X15|0.70" <%if format = "15X15" then%> selected="selected"<%end if%>>15x15</option>
<option value="15X20|0.90" <%if format = "15X20" then%> selected="selected"<%end if%>>15x20</option>
<option value="15X22,5|0.90" <%if format = "15X22,5" then%> selected="selected"<%end if%>>15x22,5</option>
<option value="18X24|1.20" <%if format = "18X24" then%> selected="selected"<%end if%>>18x24</option>
<option value="20X25|1.50" <%if format = "20X25" then%> selected="selected"<%end if%>>20x25</option>
<option value="20X30|1.50" <%if format = "20X30" then%> selected="selected"<%end if%>>20x30</option>
<option value="24X24|2.20" <%if format = "24X24" then%> selected="selected"<%end if%>>24x24</option>
<option value="24X36|3.00" <%if format = "24X36" then%> selected="selected"<%end if%>>24x36</option>
<option value="30X30|3.00" <%if format = "30X30" then%> selected="selected"<%end if%>>30x30</option>
<option value="30X40|3.90" <%if format = "30X40" then%> selected="selected"<%end if%>>30x40</option>
<option value="30X45|3.90" <%if format = "30X45" then%> selected="selected"<%end if%>>30x45</option>
<option value="30X60|6.00" <%if format = "30X60" then%> selected="selected"<%end if%>>30x60</option>
<option value="30X70|7.00" <%if format = "30X70" then%> selected="selected"<%end if%>>30x70</option>
<option value="30X80|9.00" <%if format = "30X80" then%> selected="selected"<%end if%>>30x80</option>
<option value="35X50|10.00" <%if format = "35X50" then%> selected="selected"<%end if%>>35x50</option>
<option value="50X50|10.00" <%if format = "50X50" then%> selected="selected"<%end if%>>50x50</option>
<option value="50X70|12.00" <%if format = "50X70" then%> selected="selected"<%end if%>>50x70</option>
</select>
<% if displayPulsanti = true then %>
<input type="button" value="Imposta x tutti" title="Assegna formato a tutte" onclick="assegnaFormatoATutti(<%=iContatore%>)">
<% end if %>
</div>
<% formats = formatos(i) %>
<div id="box<%=iContatore%>">
<select size="1" name="formatos" id="formatos<%=iContatore%>" onchange="changeTotale<%=iContatore%>()" >
<option value="15X20|1.50" <%if formats = "15X20|1.50" then%> selected="selected"<%end if%>>15x20</option>
<option value="15X22,5|1.50" <%if formats = "15X22,5|1.50" then%> selected="selected"<%end if%>>15x22,5</option>
<option value="20X25|2.50" <%if formats = "20X25|2.50" then%> selected="selected"<%end if%>>20x25</option>
<option value="20X30|2.50" <%if formats = "20X30|2.50" then%> selected="selected"<%end if%>>20x30</option>
<option value="24X36|4.50" <%if formats = "24X36|4.50" then%> selected="selected"<%end if%>>24x36</option>
<option value="30X30|4.50" <%if formats = "30X30|4.50" then%> selected="selected"<%end if%>>30x30</option>
<option value="30X40|5.00" <%if formats = "30X40|5.00" then%> selected="selected"<%end if%>>30x40</option>
<option value="30X45|5.00" <%if formats = "30X45|5.00" then%> selected="selected"<%end if%>>30x45</option>
<option value="30X60|7.50" <%if formats = "30X60|7.50" then%> selected="selected"<%end if%>>30x60</option>
<option value="30X70|9.50" <%if formats = "30X70|9.50" then%> selected="selected"<%end if%>>30x70</option>
<option value="30X80|9.50" <%if formats = "30X80|9.50" then%> selected="selected"<%end if%>>30x80</option>
<option value="30X90|9.50" <%if formats = "30X90|9.50" then%> selected="selected"<%end if%>>30x80</option>
<option value="35X35|10.00" <%if formats = "35X35|10.00" then%> selected="selected"<%end if%>>35x50</option>
<option value="35X50|10.00" <%if formats = "35X50|10.00" then%> selected="selected"<%end if%>>35x50</option>
<option value="40X40|10.00" <%if formats = "40X40|10.00" then%> selected="selected"<%end if%>>35x50</option>
<option value="50X50|11.00" <%if formats = "50X50|11.00" then%> selected="selected"<%end if%>>50x50</option>
<option value="50X50|11.00" <%if formats = "50X50|11.00" then%> selected="selected"<%end if%>>50x70</option>
</select>
<% if displayPulsanti = true then %>
<input type="button" value="Imposta x tutti" title="Assegna formato a tutte" onclick="assegnaFormatoATuttib(<%=iContatore%>)">
<% end if %>
</div>
</td>
<td bgcolor="#FFFFFF" width="121">
<p align="center">
<% support = supporto(i) %>
<select size="1" id="supporto<%=iContatore%>" name="supporto" onchange="hideshow(<%=iContatore%>)" >
<option value="lucida" <%if support = "lucida" then%> selected="selected"<%end if%>>lucida</option>
<option value="opaca" <%if support = "opaca" then%> selected="selected"<%end if%>>opaca</option>
<option value="seta" <%if support = "seta" then%> selected="selected"<%end if%>>seta</option>
<option value="metal" <%if support = "metal" then%> selected="selected"<%end if%>>metal</option>
</select>
<% if displayPulsanti = true then %>
<input type="button" value="Imposta x tutti" title="Assegna supporto a tutte" onclick="assegnaSupportoATutti(<%=iContatore%>)">
<% end if %>
</td>
<td bgcolor="#FFFFFF" width="129">
<p align="center">
<input type="text" name="quantita" size="4" value="1" id="quantita<%=iContatore%>" value="<%=quantita(i)%>" onkeyup="changeTotale<%=iContatore%>()"> <% if displayPulsanti = true then %>
<input type="button" value="Imposta x tutti" title="Assegna quantita a tutte" onclick="assegnaQuantitaATutti(<%=iContatore%>)">
<% end if %>
</td>
<td bgcolor="#FFFFFF" width="79" align="center">
<font size="2" face="Tahoma">
€ <div style="display:inline;" id="risultato<%=iContatore%>"></div></font>
<input type="hidden" name="risultato" id="risultatob<%=iContatore%>" value="" size="10">
</td>
<td width="14" bgcolor="#FFFFFF">
<p align="center">
<a href="cancellaFILEgallery2.asp?file=<%=Response.Write(strFile.name)%>">
<img border="0" src="../images/delete.png" width="14" height="14" alt="cancella foto" onclick="return window.confirm('Questa operazione è irreversibile!\nCancellerà il file selezionato\nSe vuoi continuare clicca su OK!');"></a></td>
<script language="javascript" type="text/javascript">
document.getElementById("box<%=iContatore%>").style.display = "none";
window.open;
</script>
<%
iContatore = iContatore + 1
end if
Next
Set objFso = Nothing
Set objFolder = Nothing
Set objFiles = Nothing
%>
Come si vede è solo la parte che mi interessa del ciclo FSO, come si può vedere ho messo l'ubound cui l'array è presa dal nr di foto del db, forse dovrei prendere in questo caso l'array del ciclo fso.
Comunque così ho questo errore:
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '18
Aiutatemi vi prego.
Ho necessità di prendere dal db solo i dati dei file presenti nella cartella sul server.
Grazie
G.