Foros del Web » Programando para Internet » ASP Clásico »

upload funciona en un ordenador y no en otro (Trabajando con IIS)

Estas en el tema de upload funciona en un ordenador y no en otro (Trabajando con IIS) en el foro de ASP Clásico en Foros del Web. Subir ficheros al servidor mediante ASP (ASPTUTOR) En un ordenador me funciona y en otro obtengo este error (trabajando con IIS) HTTP 500.100. Error interno ...
  #1 (permalink)  
Antiguo 25/07/2003, 02:14
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
upload funciona en un ordenador y no en otro (Trabajando con IIS)

Subir ficheros al servidor mediante ASP
(ASPTUTOR)
En un ordenador me funciona y en otro obtengo este error (trabajando con IIS)
HTTP 500.100. Error interno del servidor: error de ASP
Servicios de Internet Information Server

Información técnica (para personal de soporte técnico)
· Tipo de error:
Error de Microsoft VBScript en tiempo de ejecución (0x800A0046)
Permiso denegado
/forojb/saveany.asp, line 156
· Tipo de explorador:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
· Página:
POST 156379 bytes to /forojb/saveany.asp
· Datos de POST:
error '80020009'
Ocurrió una excepción.
/iisHelp/common/500-100.asp, line 223

El codigo es este:
Colaboración enviada por Alvaro Miguel
Este ejemplo nos muestra como subir un fichero desde el disco duro del cliente a un directorio de nuestro servidor; consta de un solo modulo que realiza las funciones de selección del fichero para upload (case 1) y las de la transmisión propiamente dicha (case 2)
saveany.asp
<%@LANGUAGE="VBSCRIPT"%><%response.buffer=trueFu nc = Request("Func")if isempty(Func) ThenFunc = 1End ifSelect Case FuncCase 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="saveany.asp?func=2" METHOD=POST id=form1 name=form1> <TABLE align="center"><TR> <TD>&nbsp;</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 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><%Case 2ForWriting = 2adLongVarChar = 201lngNumberUploaded = 0'Get binary data from form noBytes = Request.TotalBytes binData = Request.BinaryRead (noBytes)'convery the binary data to a stringSet RST = CreateObject("ADODB.Recordset")LenBinary = LenB(binData)if LenBinary > 0 ThenRST.Fields.Append "myBinary", adLongVarChar, LenBinaryRST.OpenRST.AddNewRST("myBinary").AppendC hunk BinDataRST.UpdatestrDataWhole = RST("myBinary")End if'Creates a raw data file for with all da' ta sent. Uncomment for debuging. 'Set fso = CreateObject("Scripting.FileSystemObject")'Set f = fso.OpenTextFile(server.mappath(".") & "\raw.txt", ForWriting, True)'f.Write strDataWhole'set f = nothing'set fso = nothing'get the boundry indicatorstrBoundry = 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) - 1Do While lngCurrentEnd > 0'Get the data between current boundry an' d 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=") + 10lngEndFileName = instr(lngBeginFileName,strData,chr(34)) 'Make sure they selected at least one fi' le. if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 ThenResponse.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 b' oxes. if lngBeginFileName <> lngEndFileName ThenstrFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)'Creates a raw data file with data betwe' en current boundrys. Uncomment for debug' ing. 'Set fso = CreateObject("Scripting.FileSystemObject")'Set f = fso.OpenTextFile(server.mappath(".") & "\raw_" & lngNumberUploaded & ".txt", ForWriting, True)'f.Write strData'set f = nothing'set fso = nothing'Loose the path information and keep jus' t the file name. tmpLng = instr(1,strFilename,"\")Do While tmpLng > 0PrevPos = tmpLngtmpLng = instr(PrevPos + 1,strFilename,"\")LoopFileName = right(strFilename,len(strFileName) - PrevPos)'Get the begining position of the file d' ata sent.'if the file type is registered with the' browser then there will be a Content-Typ' elngCT = instr(1,strData,"Content-Type:")if lngCT > 0 ThenlngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4ElselngBeginPos = lngEndFileNameEnd if'Get the ending position of the file dat' a 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("..") & "\TuDirectorio\" &_ FileName, ForWriting, True)f.Write strFileDataSet f = nothingSet fso = nothinglngNumberUploaded = lngNumberUploaded + 1End if'Get then next boundry postitions if any' .lngCurrentBegin = instr(1,strDataWhole,strBoundry)lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1loopResponse.Write "Archivo subido"Response.Write lngNumberUploaded & " archivo ya está en el servidor.<BR>"Response.Write "<BR><BR><INPUT type='button' onclick='document.location=" & chr(34) & "saveany.asp" & chr(34) & "' value='<< Volver' id='button'1 name='button'1>" End Select %></BODY></HTML>
  #2 (permalink)  
Antiguo 25/07/2003, 05:33
Avatar de Tk421  
Fecha de Ingreso: agosto-2001
Ubicación: Australia
Mensajes: 384
Antigüedad: 22 años, 9 meses
Puntos: 0
Comprueba los permisos de la carperta donde se va a hacer el upload y/o el usuario que lo esta ejecutando. La parte del error que te tienes que fijar es:

Permiso denegado
/forojb/saveany.asp, line 156

Chekea dicha linea del script y posteala si no has dado con la solucion.
__________________
Tk421
Configuration management for Linux
  #3 (permalink)  
Antiguo 25/07/2003, 12:12
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
'Create the file.
Set fso = CreateObject("Scripting.FileSystemObject")
'ABAJO ESTA LA LINEA 156
Set f = fso.OpenTextFile(server.mappath("..") & "\forojb\activos\imagenes\" &_
FileName, ForWriting, True)
f.Write strFileData
Set f = nothing
Set fso = nothing

lngNumberUploaded = lngNumberUploaded + 1

End if
  #4 (permalink)  
Antiguo 25/07/2003, 12:16
Avatar de Don Graff  
Fecha de Ingreso: noviembre-2002
Ubicación: San Bernardo - Chile
Mensajes: 410
Antigüedad: 21 años, 6 meses
Puntos: 0
son los permisos de la carpeta donde pretendes subir los archivos...tienes que ponerle permisos de lectura y escritura...
__________________
:cool: Visita Zona Powers :cool:
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:54.