guarda purtroppo nn sono bravissimo..nn so cosa hai sbagliato..questo tipo di errore nn mi è mai capitato..ma te lo da nella pagina dell'upload o in quella in cui interroghi il db?..facciamo così..ti posto entrambe le mie pagine..ovviamente rese all'osso senza grafica..
questa e per l'upload...
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<!--#include file="Connections/connessione.asp" -->
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
'*** Pure ASP File Upload -----------------------------------------------------
' Copyright (c) 2001-2002 George Petrov,
www.UDzone.com
' Process the upload
' Version: 2.0.9
'------------------------------------------------------------------------------
'*** File Upload to: """public""", Extensions: "GIF,JPG,JPEG,BMP,PNG", Form: form1, Redirect: "Up-ok.asp", "path", "", "over", "true", "", "" , "", "", "", "", "600", "", "300", "100"
Dim GP_redirectPage, RequestBin, UploadQueryString, GP_uploadAction, UploadRequest
PureUploadSetup
If (CStr(Request.QueryString("GP_upload")) <> "") Then
on error resume next
Dim reqPureUploadVersion, foundPureUploadVersion
reqPureUploadVersion = 2.09
foundPureUploadVersion = getPureUploadVersion()
if err or reqPureUploadVersion > foundPureUploadVersion then
Response.Write "<b>You don't have latest version of ScriptLibrary/incPureUpload.asp uploaded on the server.</b><br>"
Response.Write "This library is required for the current page. It is fully backwards compatible so old pages will work as well.<br>"
Response.End
end if
on error goto 0
GP_redirectPage = "Up-ok.asp"
Server.ScriptTimeout = 600
RequestBin = Request.BinaryRead(Request.TotalBytes)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin, """public""", "path", "", "over"
If (GP_redirectPage <> "" and not (CStr(UploadFormRequest("MM_insert")) <> "" or CStr(UploadFormRequest("MM_update")) <> "")) Then
If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
End If
Response.Redirect(GP_redirectPage)
end if
else
if UploadQueryString <> "" then
UploadQueryString = UploadQueryString & "&GP_upload=true"
else
UploadQueryString = "GP_upload=true"
end if
end if
' End Pure Upload
'------------------------------------------------------------------------------
</SCRIPT>
<%
// *** Edit Operations: (Modified for File Upload) declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (UploadQueryString) {
MM_editAction += "?" + Server.HTMLEncode(UploadQueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
// query string to execute
var MM_editQuery = "";
%>
<%
// *** Insert Record: (Modified for File Upload) set variables
if (String(UploadFormRequest("MM_insert")) == "form1") {
var MM_editConnection = MM_connessione_STRING;
var MM_editTable = "press";
var MM_editRedirectUrl = "Up-ok.asp";
var MM_fieldsStr = "titolo|value|file|value";
var MM_columnsStr = "titolo|',none,''|foto|',none,NULL";
// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|");
var MM_columns = MM_columnsStr.split("|");
// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(UploadFormRequest(MM_fields
));
}
// append the query string to the redirect URL
if (MM_editRedirectUrl && UploadQueryString && UploadQueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + UploadQueryString;
}
}
%>
<%
// *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it
if (String(UploadFormRequest("MM_insert")) != "undefined") {
// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(",");
var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined") {
formVal = emptyVal;
} else {
if (altVal != "") {
formVal = altVal;
} else if (delim == "'") { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''") + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "") + MM_columns;
MM_dbValues += ((i != 0) ? "," : "") + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";
if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript">
<!--
function checkFileUpload(form,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
document.MM_returnValue = true;
for (var i = 0; i<form.elements.length; i++) {
field = form.elements;
if (field.type.toUpperCase() != 'FILE') continue;
checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }
function checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
document.MM_returnValue = true;
if (extensions != '') var re = new RegExp("\.(" + extensions.replace(/,/gi,"|").replace(/\s/gi,"") + ")$","i");
if (field.value == '') {
if (requireUpload) {alert('File is required!');document.MM_returnValue = false;field.focus();return;}
} else {
if(extensions != '' && !re.test(field.value)) {
alert('This file type is not allowed for uploading.\nOnly the following file extensions are allowed: ' + extensions + '.\nPlease select another file and try again.');
document.MM_returnValue = false;field.focus();return;
}
document.PU_uploadForm = field.form;
re = new RegExp(".(gif|jpg|png|bmp|jpeg)$","i");
if(re.test(field.value) && (sizeLimit != '' || minWidth != '' || minHeight != '' || maxWidth != '' || maxHeight != '' || saveWidth != '' || saveHeight != '')) {
checkImageDimensions(field,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }
}
function showImageDimensions(fieldImg) { //v2.09
var isNS6 = (!document.all && document.getElementById ? true : false);
var img = (fieldImg && !isNS6 ? fieldImg : this);
if (img.width > 0 && img.height > 0) {
if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)) {
alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth + ' x ' + img.minHeight); return;}
if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)) {
alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x ' + img.maxHeight); return;}
if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) {
alert('Uploaded Image File Size is too big!\nShould be max ' + (img.sizeLimit/1024) + ' KBytes'); return;}
if (img.saveWidth != '') document.PU_uploadForm[img.saveWidth].value = img.width;
if (img.saveHeight != '') document.PU_uploadForm[img.saveHeight].value = img.height;
document.MM_returnValue = true;
} }
function checkImageDimensions(field,sizeL,minW,minH,maxW,maxH,saveW,saveH) { //v2.09
if (!document.layers) {
var isNS6 = (!document.all && document.getElementById ? true : false);
document.MM_returnValue = false; var imgURL = 'file:///' + field.value.replace(/\\/gi,'/').replace(/:/gi,'|').replace(/"/gi,'').replace(/^\//,'');
if (!field.gp_img || (field.gp_img && field.gp_img.src != imgURL) || isNS6) {field.gp_img = new Image();
with (field) {gp_img.sizeLimit = sizeL*1024; gp_img.minWidth = minW; gp_img.minHeight = minH; gp_img.maxWidth = maxW; gp_img.maxHeight = maxH;
gp_img.saveWidth = saveW; gp_img.saveHeight = saveH; gp_img.onload = showImageDimensions; gp_img.src = imgURL; }
} else showImageDimensions(field.gp_img);}
}
//-->
</script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.style1 {color: #FFFFFF}
-->
</style></head>
<body>
<div align="center">
<p> </p>
<table width="100%" >
<tr>
<th width="50%" height="59" align="right" scope="col"><p><a href="bak.asp"><strong>Torna indietro</strong></a></p>
<p><strong><a href="bak.asp"><span class="style1">.</span></a> </strong></p></th>
<th width="50%" scope="col"> </th>
</tr>
</table>
<p align="center"> </p>
<p align="center"> </p>
<form action="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','');return document.MM_returnValue">
<table width="52%" border="0">
<tr>
<th width="29%" align="right" scope="row"><div align="right">titolo</div></th>
<td width="71%" align="left"><input name="titolo" type="text" id="titolo" /></td>
</tr>
<tr>
<th align="right" valign="top" scope="row">file</th>
<td align="left" valign="top"> <input name="file" type="file" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','')" />
<input type="submit" name="Submit" value="invia" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</div>
</body>
</html>
e quest'altra e pre richiamare l'immagine..
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connessione.asp" -->
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_connessione_STRING;
Recordset1.Source = "SELECT * FROM press";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Recordset1_numRows += Repeat1__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>galleria immagini lavori di grafica</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
a:link {
color: #999999;
}
a:visited {
color: #999999;
}
a:hover {
color: #999999;
}
a:active {
color: #999999;
}
.style1 {color: #999999}
-->
</style></head>
<body>
<% while ((Repeat1__numRows-- != 0) && (!Recordset1.EOF)) { %>
<div align="center"><br />
<br />
<table width="59%" height="170" border="0">
<tr>
<th width="52%" height="164" align="left" valign="top" scope="col">
<table width="90%" height="149" border="0">
<tr>
<th scope="col"><table width="83%" height="137" border="1">
<tr>
<th scope="col"><div align="center"><a href="foto.asp?ID=<%=(Recordset1.Fields.Item("ID").Value)%>" target="_blank"><img src="<%=(Recordset1.Fields.Item("foto").Value)%>" width="150" border="0" /></a></div></th>
</tr>
</table></th>
<th scope="col"><span class="style1"><%=(Recordset1.Fields.Item("titolo").Value)%></span></th>
</tr>
</table>
<hr align="left" width="400" /></th>
<th width="48%" align="left" valign="top" scope="col"> </th>
</tr>
</table>
</div>
<%
Repeat1__index++;
Recordset1.MoveNext();
}
%>
<p align="center"> </p>
</body>
</html>
<%
Recordset1.Close();
%>
prova a creare due fogli vuoti asp js..incolla tutto com'è ( ovviamente adattando lo script al tuo db..parlo del file di connessione in particolare..e il nome della tua tabella e campo..) prova e se funziona prova a confrontarlo con il tuo codice e adattare il tutto..fammi sapere....ciao..