He tocado básicamente la parte de asp y ligeramente el javascript.
En mi compu funcionó ok, te dejo el código de ambos archivos en base a lo que me enviaste por email el otro día:
página inicial
prueba.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<script language="javascript" type="text/javascript">
function subFoto() {
open("upload.asp","","width=500,height=350,toolbar =no,directories=no,menubar=no,status=no");
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="armar" method="post" action="">
<input type="text" name="foto" class="frmText" size="25">
<input type="text" name="foto2" class="frmText" size="25">
<input type="text" name="foto3" class="frmText" size="25">
<input type="button" value=prueba name="btnFoto" onClick="subFoto()">
</form>
</body>
</html>
************************************
Página
upload.asp
<%@LANGUAGE="VBSCRIPT"%>
<%response.buffer=true%>
<%
Func = Request("Func")
if isempty(Func) Then
Func = 1
End if
Select Case Func
Case 1
%>
<table width="360" border="0" align="center">
<tr>
<td>
<div align="center">Selecciona una imagen para subir. </div>
</td>
</tr>
</table>
<form enctype="multipart/form-data" action="upload.asp?func=2" method=POST id=form1 name=form1>
<table align="center">
<tr>
<td> </td>
</tr>
<tr>
<td><font color="#330066" size="2">Pulsa en el botón examinar y elige el archivo
de tu ordenador.<br>
<br>
</font></td>
</tr>
<tr>
<td><font color="#330066" size="2">Luego pulsa el botón subir.<br>
<br>
</font></td>
</tr>
<tr>
<td><strong><font color="#330066" size="2">Nombre del archivo...</font></strong></td>
</tr>
<tr>
<td> <font size="2">
<input name=File1 size=30 type=file>
<br>
</font></td>
</tr>
<tr>
<td><strong><font color="#330066" size="2">Nombre del archivo...</font></strong></td>
</tr>
<tr>
<td> <font size="2">
<input name=File2 size=30 type=file>
<br>
</font></td>
</tr>
<tr>
<td><strong><font color="#330066" size="2">Nombre del archivo...</font></strong></td>
</tr>
<tr>
<td> <font size="2">
<input name=File3 size=30 type=file>
<br>
</font></td>
</tr>
<tr>
<td align=left>
<input type="submit" value="Subir">
<br>
<br>
</td>
</tr>
<tr>
<td><font color="#330066" size="2">NOTA: Espera, recibirás una notificación
cuando el archivo haya sido subido</font><font size="2">.<br>
<br>
</font></td>
</tr>
</table>
</form>
<%
Case 2
ForWriting = 2
adLongVarChar = 201
lngNumberUploaded = 0
'Get binary data from form
noBytes = Request.TotalBytes
binData = Request.BinaryRead (noBytes)
'convery the binary data to a string
Set RST = CreateObject("ADODB.Recordset")
LenBinary = LenB(binData)
if LenBinary > 0 Then
RST.Fields.Append "myBinary", adLongVarChar, LenBinary
RST.Open
RST.AddNew
RST("myBinary").AppendChunk BinData
RST.Update
strDataWhole = RST("myBinary")
End if
strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE")
lngBoundryPos = instr(1,strBoundry,"boundary=") + 8
strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos)
'Get first file boundry positions.
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
Dim FileNameTotal,contador
contador = 1
%>
<script language="Javascript1.2">
function cierra_ventana() {
<%
Do While lngCurrentEnd > 0
'Get the data between current boundry and remove it from the whole.
strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)
strDataWhole = replace(strDataWhole,strData,"")
'Get the full path of the current file.
lngBeginFileName = instr(1,strdata,"filename=") + 10
lngEndFileName = instr(lngBeginFileName,strData,chr(34))
'Make sure they selected at least one file.
if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then
Response.Write "<H2> Ha ocurrido el siguiente error.</H2>"
Response.Write "Debes elegir un archivo para subir"
Response.Write "<BR><BR>Pulsa el botón volver, realiza la corrección."
Response.Write "<BR><BR><INPUT type='button' onclick='history.go(-1)' value='<< Volver' id='button'1 name='button'1>"
Response.End
End if
'There could be one or more empty file boxes.
if lngBeginFileName <> lngEndFileName Then
strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
'Loose the path information and keep jus
' t the file name.
tmpLng = instr(1,strFilename,"\")
Do While tmpLng > 0
PrevPos = tmpLng
tmpLng = instr(PrevPos + 1,strFilename,"\")
Loop
FileName = right(strFilename,len(strFileName) - PrevPos)
if contador = 1 then
FileNameTotal = FileName
else
FileNameTotal = FileNameTotal & ", " & FileName
end if
'Get the begining position of the file data sent.
'if the file type is registered with the
' browser then there will be a Content-Type
lngCT = instr(1,strData,"Content-Type:")
if lngCT > 0 Then
lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
Else
lngBeginPos = lngEndFileName
End if
'Get the ending position of the file data sent.
lngEndPos = len(strData)
'Calculate the file size.
lngDataLenth = lngEndPos - lngBeginPos
'Get the file data
strFileData = mid(strData,lngBeginPos,lngDataLenth)
'Create the file.
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile (Server.MapPath ("\fotos") & "\" & FileName, ForWriting, True)
Dim FileName
f.Write strFileData
Set f = nothing
Set fso = nothing
lngNumberUploaded = lngNumberUploaded + 1
End if
'Get then next boundry postitions if any
' .
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
if contador <> 1 then
%>
opener.document.armar.foto<%=contador%>.value = "<%=FileName%>";
<%
else
%>
opener.document.armar.foto.value = "<%=FileName%>";
<%
end if
contador = contador+1
loop
End Select
%>
close();
}
</script>
Archivo subido
<%=FileNameTotal%> archivo ya está en el servidor.<br>
<input type="button" onClick="cierra_ventana()" value="Cerrar" >
</BODY>
</HTML>
Yá me contarás