Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

matesi

Problemas com o upload

Recommended Posts

Não envia o arquivo. Aparece o erro:Tipo de erro:Erro de tempo de execução do Microsoft VBScript (0x800A01A8)Objeto necessário: 'UploadRequest'/trab/upload2.asp, line 3O código para verificar é:(antes deste código tem um include da classe.)contentType = UploadRequest.Item("Arquivo").Item("ContentType")filepathname = UploadRequest.Item("Arquivo").Item("FileName")filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,""))scriptnameurl = len(Request.ServerVariables("script_name"))value = UploadRequest.Item("Arquivo").Item("Arquivo")Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO"))) - scriptnameurlSet MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&filename)For i = 1 to LenB(value)MyFile.Write chr(AscB(MidB(value,i,1)))NextMyFile.CloseMe ajudem,por favor!

Compartilhar este post


Link para o post
Compartilhar em outros sites

esse aqui não precisa de componente

(na pasta onde for testar crie uma pasta chamada "tmp")

 

 

 

<%

session("EnviarAux") = "tmp\"

%>

 

<html><head><title>UPLOAD</title>

<link href=css/estilos2.css rel=stylesheet type=text/css></style>

</head>

<body bgcolor=ffffff text=000000 cellspacing=0 cellpadding=0 topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 margin=0px border=0><center>

<table width=100% height=100% cellspacing=0 cellpadding=0 border=0 class=texto><tr><td align=center valign=middle>

<!-- inicio -->

 

<B>E n v i a r    A r q u i v o</b>

<div align=left style=width:200px;>

<FORM METHOD="Post" ENCTYPE="multipart/form-data" ACTION="upload.asp">

<INPUT TYPE="file" size=20 NAME="File1" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File2" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File3" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File4" class=entrada><p><br>

</div>

 

<INPUT TYPE="submit" NAME="Enter" value=" enviar " class=botao>

      

<input type=button value=fechar onclick=java script:window.close('del'); onkeydown=java script:window.close('del'); onkeypress=java script:window.close('del'); class=botao>

</FORM>

 

 

<!-- fim -->

 

<!-- <%=session("EnviarAux")%> -->

</td></tr></table>

</center></body></html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ulpoad.asp

 

<%

On Error Resume Next

ForWriting = 2

lngNumberUploaded = 0

noBytes = Request.TotalBytes

binData = Request.BinaryRead (noBytes)

Set RST = CreateObject("ADODB.Recordset")

LenBinary = LenB(binData)

if LenBinary > 0 Then

RST.Fields.Append "myBinary", 201, 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)

lngCurrentBegin = instr(1,strDataWhole,strBoundry)

lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

Do While lngCurrentEnd > 0

strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)

strDataWhole = replace(strDataWhole,strData,"")

lngBeginFileName = instr(1,strdata,"filename=") + 10

lngEndFileName = instr(lngBeginFileName,strData,chr(34))

if lngBeginFileName <> lngEndFileName and lngBeginFileName - 10 <> 0 Then

strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)

tmpLng = instr(1,strFilename,"\")

Do While tmpLng > 0

PrevPos = tmpLng

tmpLng = instr(PrevPos + 1,strFilename,"\")

Loop

FileName = right(strFilename,len(strFileName) - PrevPos)

lngCT = instr(1,strData,"Content-Type:")

if lngCT > 0 Then

lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4

else

lngBeginPos = lngEndFileName

End if

lngEndPos = len(strData)

lngDataLenth = lngEndPos - lngBeginPos

strFileData = mid(strData,lngBeginPos,lngDataLenth)

 

dir2 = Session("EnviarAux")

Set fso = CreateObject("Scripting.FileSystemObject")

path = mid(Server.MapPath("upload.asp"),1,instr(1,Server.MapPath("upload.asp"),"upload.asp",1)-1)

if dir2 <> "" then

path = path&dir2&"\"

path = replace(path,dirGere,"")

else

path = replace(path,dirGere,"")

end if

Set f = fso.OpenTextFile(path & FileName, ForWriting, True)

f.Write strFileData

Set f = nothing

Set fso = nothing

lngNumberUploaded = lngNumberUploaded + 1

End if

lngCurrentBegin = instr(1,strDataWhole,strBoundry)

lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

loop

 

 

function ParseForm(strFieldName)

strFormData = teste

lngNamePos = instr(1,strFormData,"name=" & chr(34) & strFieldName & chr(34))

if lngNamePos = 0 Then

ParseForm="não"

Else

lngBeginFieldData = instr(lngNamePos,strFormData,vbcrlf & vbcrlf)+4

 

if strFieldName <> "texto" then

lngEndFieldData = instr(lngBeginFieldData,strFormData,vbcrlf)

else

lngEndFieldData = instr(lngBeginFieldData,strFormData,"*")

end if

ParseForm=mid(strFormData,lngBeginFieldData,lngEndFieldData-lngBeginFieldData)

End if

End function

 

If Err <> 0 Then

Response.Write "Erro:-> " & Err.Description

else

resposta = " Transmissão Efetivada com Sucesso !!!"

end if

%>

 

 

<%=resposta%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

esse aqui não precisa de componente

(na pasta onde for testar crie uma pasta chamada "tmp")

 

 

 

<%

session("EnviarAux") = "tmp\"

%>

 

<html><head><title>UPLOAD</title>

<link href=css/estilos2.css rel=stylesheet type=text/css></style>

</head>

<body bgcolor=ffffff text=000000 cellspacing=0 cellpadding=0 topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 margin=0px border=0><center>

<table width=100% height=100% cellspacing=0 cellpadding=0 border=0 class=texto><tr><td align=center valign=middle>

<!-- inicio -->

 

<B>E n v i a r    A r q u i v o</b>

<div align=left style=width:200px;>

<FORM METHOD="Post" ENCTYPE="multipart/form-data" ACTION="upload.asp">

<INPUT TYPE="file" size=20 NAME="File1" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File2" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File3" class=entrada><br>

<INPUT TYPE="file" size=20 NAME="File4" class=entrada><p><br>

</div>

 

<INPUT TYPE="submit" NAME="Enter" value=" enviar " class=botao>

      

<input type=button value=fechar onclick=java script:window.close('del'); onkeydown=java script:window.close('del'); onkeypress=java script:window.close('del'); class=botao>

</FORM>

 

 

<!-- fim -->

 

<!-- <%=session("EnviarAux")%> -->

</td></tr></table>

</center></body></html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ulpoad.asp

 

<%

On Error Resume Next

ForWriting = 2

lngNumberUploaded = 0

noBytes = Request.TotalBytes

binData = Request.BinaryRead (noBytes)

Set RST = CreateObject("ADODB.Recordset")

LenBinary = LenB(binData)

if LenBinary > 0 Then

RST.Fields.Append "myBinary", 201, 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)

lngCurrentBegin = instr(1,strDataWhole,strBoundry)

lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

Do While lngCurrentEnd > 0

strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)

strDataWhole = replace(strDataWhole,strData,"")

lngBeginFileName = instr(1,strdata,"filename=") + 10

lngEndFileName = instr(lngBeginFileName,strData,chr(34))

  if lngBeginFileName <> lngEndFileName and lngBeginFileName - 10 <> 0 Then

  strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)

  tmpLng = instr(1,strFilename,"\")

  Do While tmpLng > 0

  PrevPos = tmpLng

  tmpLng = instr(PrevPos + 1,strFilename,"\")

  Loop

  FileName = right(strFilename,len(strFileName) - PrevPos)

  lngCT = instr(1,strData,"Content-Type:")

  if lngCT > 0 Then

  lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4

  else

  lngBeginPos = lngEndFileName

  End if

  lngEndPos = len(strData)

  lngDataLenth = lngEndPos - lngBeginPos

  strFileData = mid(strData,lngBeginPos,lngDataLenth)

 

  dir2 = Session("EnviarAux")

  Set fso = CreateObject("Scripting.FileSystemObject")

  path = mid(Server.MapPath("upload.asp"),1,instr(1,Server.MapPath("upload.asp"),"upload.asp",1)-1)

  if dir2 <> "" then

  path = path&dir2&"\"

  path = replace(path,dirGere,"")

  else

  path = replace(path,dirGere,"")

  end if

  Set f = fso.OpenTextFile(path & FileName, ForWriting, True)

  f.Write strFileData

  Set f = nothing

  Set fso = nothing

  lngNumberUploaded = lngNumberUploaded + 1

  End if

lngCurrentBegin = instr(1,strDataWhole,strBoundry)

lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

loop

 

 

function ParseForm(strFieldName)

strFormData = teste

lngNamePos = instr(1,strFormData,"name=" & chr(34) & strFieldName & chr(34))

  if lngNamePos = 0 Then

  ParseForm="não"

  Else

  lngBeginFieldData = instr(lngNamePos,strFormData,vbcrlf & vbcrlf)+4

 

  if strFieldName <> "texto" then

  lngEndFieldData = instr(lngBeginFieldData,strFormData,vbcrlf)

  else

  lngEndFieldData = instr(lngBeginFieldData,strFormData,"*")

  end if

  ParseForm=mid(strFormData,lngBeginFieldData,lngEndFieldData-lngBeginFieldData)

  End if

End function

 

If Err <> 0 Then

Response.Write "Erro:-> " & Err.Description

else

resposta = " Transmissão Efetivada com Sucesso !!!"

end if

%>

 

 

<%=resposta%>

Eu preciso deste código tambem.

mas ele mostra este quando clica em enviar.

 

 

 

Erro:-> O objeto é obrigatório

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.