Hej!
Jag har ett problem när jag ska ladda upp två bilder (låg- resp. högupplöst) till en bildbank. Vad som händer är att bild nr.2 (tryck) skriver över bild nr.1 (webb). Vet inte vad för fel jag gör i min kod, men blir glad om någon kan titta och säga vad som är fel.
Det skapas två bildfiler men båda är bild nr.2.
Mitt formulär:
<form method="post" enctype="multipart/form-data" action="laggtill_steg3.asp">
<input type="hidden" name="id" value="<%=IDbild%>">
<table border="0" cellpadding="2" cellspacing="0" width="96%" class="sidor">
<tr>
<td class="adminrubrik" width="20%">
Lågupplöst (webb)</td>
<td class="adminrubrik">
<input type="file" name="bildwebb" size="20" style="width:350px"></td>
</tr>
<tr>
<td class="adminrubrik" width="20%">
Högupplöst (tryck)</td>
<td class="adminrubrik">
<input type="file" name="bildtryck" size="20" style="width:350px"></td>
</tr></table>
</form>
Min kod:
Set upload = Server.CreateObject("Persits.Upload.1")
intCount = Upload.Save
actualName = upload.Form("id")
Session("ID") = actualName
if intCount = 0 then
' inga filer
response.redirect "laggtill_steg2.asp?Fil=Fel&ID=" & actualName
end if
' Ladda in bild för webb
Set File = upload.Form("bildwebb")
For Each File in Upload.Files
If File.ImageType <> "GIF" and File.ImageType <> "JPG" Then
Response.Redirect "laggtill_steg2.asp?Bild=Typ&ID=" & actualName
Exit For
End If
extension="." & LCase(File.Imagetype)
FileName = actualName & "_webb" & extension
FileWidth = File.ImageWidth
FileHeight = File.ImageHeight
File.SaveAs "c:\inetpub\wwwroot\BILDBANK\bilder\" & actualName & "_webb" & File.ext
Next
' Ladda in bild för tryck
Set File2 = upload.Form("bildtryck")
For Each File2 in Upload.Files
If File2.ImageType <> "GIF" and File2.ImageType <> "JPG" Then
Response.Redirect "laggtill_steg2.asp?Bild=Typ&ID=" & actualName
Exit For
End If
extension="." & LCase(File2.Imagetype)
FileName2 = actualName & "_tryck" & extension
FileWidth2 = File2.ImageWidth
FileHeight2 = File2.ImageHeight
File2.SaveAs "c:\inetpub\wwwroot\BILDBANK\bilder\" & actualName & "_tryck" & File2.ext
Next
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "SELECT * FROM Bilder WHERE ID = " & actualName & ""
RecSet.Open Addera, DB, adOpenStatic, adLockOptimistic
RecSet("BildWebb") = FileName
RecSet("BildWebbWidth") = FileWidth
RecSet("BildWebbHeight") = FileHeight
RecSet("BildTryck") = FileName2
RecSet("BildTryckWidth") = FileWidth2
RecSet("BildTryckHeight") = FileHeight2
RecSet.Update
RecSet.Close
Set RecSet = Nothing
//Annette