Salve ragazzi ho la necessità di poter cancellare una file dal server e successivamente caricarne uno nuovo.

Ho provato in questo modo:
codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


<%
Dim rsCaricamento__MMColParam
rsCaricamento__MMColParam = "1"
If (Request.QueryString("id_archivio") <> "") Then 
  rsCaricamento__MMColParam = Request.QueryString("id_archivio")
End If
%>
<%
Dim rsCaricamento
Dim rsCaricamento_numRows

Set rsCaricamento = Server.CreateObject("ADODB.Recordset")
rsCaricamento.ActiveConnection = MM_archivioDiCastroSql_STRING
rsCaricamento.Source = "SELECT * FROM archivio WHERE id_archivio = " + Replace(rsCaricamento__MMColParam, "'", "''") + ""
rsCaricamento.CursorType = 0
rsCaricamento.CursorLocation = 2
rsCaricamento.LockType = 1
rsCaricamento.Open()

rsCaricamento_numRows = 0
%>
<%
Dim form, FileName_file1
%>
<%
	If Request.QueryString("Save")="1" then
	Dim fs 
		Dim oUpload
Set fs=Server.CreateObject("Scripting.FileSystemObject") 
immagine = Server.MapPath("opere\" & rsCaricamento.Fields.Item("fotoOpera").Value)
if fs.FileExists(immagine) then
  fs.DeleteFile (immagine)
end if
set fs=nothing

		Set oUpload = new cUpload
		oUpload.AutoRename = True
		oUpload.Overwrite = False
		oUpload.SetPath "opere" 'Impostazione del percorso
		oUpload.Load
		While Not oUpload.EOF
			oUpload.Save()
			Select Case lCase(oUpload.Files("InputName"))
				Case "file1"
					FileName_file1 = oUpload.GetFileName()
			End Select
			oUpload.MoveNext
			Wend
			
			end if
%>
Solo che mi restituisce il seguente errore:
codice:
ADODB.Field error '800a0bcd' 

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. 

/archivioSql/diCastro_aggiornaFoto.asp, line 33
La riga 33 è questa:
immagine = Server.MapPath("opere\" & rsCaricamento.Fields.Item("fotoOpera").Value)

Lui dice che non il record è stato cancellato ma invece il record nel DB ci sta e l'immagine sul server anche.

Premetto che messi separatemente i due script funzionano. Solo che quando li vado ad unire ho il seguente errore.

In questo modo invece ne mi cancella il file ne mi carica quello nuovo.

Da cosa potrebbe dipendere?

Grazie a tutti in anticipo.