ragazzi ho un problema non riesco a trovare l'errore ...
guardata sto codice..
--------- UPLOADFOTO.ASP
codice:
<%
Function RedimFoto(nome,sizeThumb,sizeFoto)
Dim xml,tmpResult,url
Set xml = Server.CreateObject("Microsoft.Xmlhttp")
URL = "http://www.scibettabbigliamento.it/ridimensiona.aspx?foto=" & nome & "&sizeThumb=" & sizeThumb & "&sizeFoto=" & sizeFoto
xml.open "GET", URL ,false
xml.send()
tmpResult = xml.ResponseText
Set xml = nothing
if Instr(1,tmpResult,"Errore") <> 0 then
'Il ridimensionamento non è andato a buon fine
RedimFoto = false
else
RedimFoto = true
end if
End Function
connessione = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("db-base/dbbase.mdb")
dominio = "http://localhost/webserviceASPASPNET/"
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Dim oUpload
newRecord = false
Set oUpload = new cUpload
With oUpload
.EnabledAspUpload = False
.EnabledImageSize = true
.EnabledLog = False
.AutoRename = False
.Overwrite = False
.SetPath "Vetrine/"
.Load()
'Recupero la chiave che mi verra' passata o via querystring (si presuppone da una lista)
if Request.QueryString("keyFoto") <> "" then
keyFoto = Request.QueryString("keyFoto")
else
'Oppure nel caso sia submitato il form mi proviene dal campo hidden
if .Form("keyFoto") <> "" then
keyFoto = .Form("keyFoto")
else
keyFoto = 0
end if
end if
set Connection = server.CreateObject("Adodb.Connection")
connection.open connessione
set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "SELECT * FROM center where idcenter=" & keyFoto
Rs.Open Sql, connection,3,3
if Rs.eof then
Rs.addnew
newRecord = true
else
keyFoto = Rs("idcenter")
categoria = Rs("categoria")
foto = Rs("file")
end if
'Se è stato submittato il form eseguo l'update del record
if .Form("action") <> "" then
.movefirst()
Rs("categoria") = .Form("categoria")
rs("file") = "Vetrine/" & .Files("Name") & "." & .Files("Ext")
Rs.update
'Pesco la chiave in modo da aggiungerla in testa all'immagine per avere un
'nome univoco
UltimoId = Rs("idcenter")
While Not .Files.EOF
if .Files("inputName") = "imgUpload" then
'Compongo il nome
nomeFoto= .Files("Name") & "." & .Files("Ext")
'Salvo il file
.SaveAs nomeFoto
end if
.Files.MoveNext
Wend
'Eseguo il ridimensionamento e la funzione restituisce true se tutto è
'andato a buon fine
if RedimFoto(nomeFoto,100,600) then
Rs("file") = "Vetrine/" & nomeFoto
'Cancello quella originale uploadata
'Nota che il file ridimensiona.aspx è configurato in maniera tale
'che se il file di origine ed il file di destinazione sono identici anche nel
'percorso, il file viene ridimensionato su se stesso e quindi
'l'operazione di cancellazione del file originale NON DEVE essere fatta
'Fso.DeleteFile Server.MapPath("foto/" & nomeFoto)
Rs.update
else
errUpload = "Errore nel ridimensionamento delle foto"
end if
end if
end with
if newRecord then Rs.CancelUpdate
Rs.Close
Connection.Close
Set Connection = nothing
Set Rs = nothing
Set Fso = nothing
%>
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="testUpload" method="post" enctype="multipart/form-data" action="uploadFoto.asp">
<% if errUpload <> "" then Response.Write("<h1>" & errUpload & "</h1>") %>
Categoria Foto:
<input name="categoria" type="radio" value="uomo">
Uomo
<input name="categoria" type="radio" value="donna">
Donna
<input name="categoria" type="radio" value="accessori">
Accessori
File: <input type="file" name="imgUpload">
<input type="submit" name="action" value="conferma">
<% if foto <> "" then %>
<hr>
Foto precedentemente caricate
piccola:
[img]foto/piccola/<%=foto%>[/img]
grande:
[img]foto/grande/<%=foto%>[/img]
<% end if %>
<input type="hidden" name="keyFoto" value="<%=keyFoto%>">
</form>
</body>
</html>
----- RIDIMENSIONE.ASPX
codice:
<%@ Page Language="VB" ContentType="text/html"%>
<script language="vb" runat="server">
Sub Page_Load(Server as Object,e as System.EventArgs)
Dim redimFoto as String = Request.Querystring("foto")
Dim RedimSizeThumb as integer = CInt(Request.QueryString("sizeThumb"))
Dim RedimSizeFoto as integer = CInt(Request.QueryString("sizeFoto"))
ReDimImg("Vetrine/" & redimFoto ,"Vetrine/centre_flash/" & RedimFoto,RedimSizeThumb,0)
ReDimImg("Vetrine/" & redimFoto ,"Vetrine/centre_flash/" & RedimFoto,RedimSizeFoto,0)
End Sub
Public Sub ReDimImg(SourcePath as String,ResizeName as string, width as integer,height as integer)
Try
'Creo l'oggetto di riferimento al file originale
Dim TmpBmp as System.Drawing.Bitmap = CType(System.Drawing.Image.FromFile(Server.MapPath(SourcePath)), System.Drawing.Bitmap)
Dim newWidth,newHeight as string
'Se il parametro height è lasciato a 0 costruisco il with in maniera proporzionata
if height = 0 Then
newHeight = Convert.ToInt32(width / TmpBmp.Width * TmpBmp.Height)
else
newHeight = height
End if
'Se il parametro with è lasciato a 0 costruisco l'height in maniera proporzionata
if width = 0 Then
newWidth = Convert.ToInt32(height / TmpBmp.Height * TmpBmp.Width)
else
newWidth = width
end if
'Creo la miniatura con lunghezza e larghezza elaborati
Dim miniaturabmp as New System.Drawing.Bitmap(TmpBmp, newWidth, newHeight)
'Distruggo l'oggetto dell'immagine originale che non mi serve +
TmpBmp.Dispose()
'controllo l'estensione e salvo la miniatura nel giusto formato
if SourcePath.toLower().EndsWith(".jpg") or SourcePath.toLower().EndsWith(".jpeg") Then
miniaturabmp.Save(Server.MapPath(ResizeName), System.Drawing.Imaging.ImageFormat.Jpeg)
elseif SourcePath.toLower().EndsWith(".gif") Then
miniaturabmp.Save(Server.MapPath(ResizeName), System.Drawing.Imaging.ImageFormat.Gif)
elseif SourcePath.toLower().EndsWith(".png") Then
miniaturabmp.Save(Server.MapPath(ResizeName), System.Drawing.Imaging.ImageFormat.Png)
else
Response.Write("Errore Formato")
'Si puo' ampliare l'elseif in questo modo:
'elseif SourcePath.toLower().EndsWith(".[Estensione]") Then
'miniaturabmp.Save(Server.MapPath(ResizeName), System.Drawing.Imaging.ImageFormat.[Estensione])
'dove [Estensione] puo essere Bmp, Emf, Exif, Tiff, Wmf
end if
miniaturabmp.Dispose()
Catch ex as System.Exception
'Nel caso stampo l'errore:
Response.Write("<hr>Errore nel ridimensionamento dell'immagine:
" & ex.Message & "
")
Response.Write("
" & ex.StackTrace & "<hr>")
End Try
Response.Write("Ridimensionamento effettuato con successo")
End Sub
</script>
----- UPLOAD.ASP
è la classe di baol
questo script è preso da questo sito...
ecco qui
QUESTO è L'ERRORE CHE MI RESTITUISCE ALLA PRESSIONE DEL PULSANTE IN UPLOADFOTO.ASP
codice:
Impossibile visualizzare la pagina
Impossibile visualizzare la pagina desiderata. Si è verificato un problema.
--------------------------------------------------------------------------------
Provare a eseguire le operazioni seguenti:
Aprire la pagina iniziale www.scibettabbigliamento.it, quindi cercare i collegamenti alle informazioni desiderate.
Scegliere il pulsante Aggiorna o riprovare in un secondo momento.
Fare clic sul pulsante Cerca per ricercare informazioni su Internet.
È anche possibile visualizzare un elenco di siti correlati.
HTTP 500 - Errore interno del server
Internet Explorer
CHE DEVO FARE?
GRAZIE