Ir para conteúdo
Fórum Script Brasil
  • 0

Upload


davi.sza

Pergunta

Preciso de uma ajuda por favor.

Está aparecendo este erro fazer upload de arquivos:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/teste/upload.asp, line 50

function ParseForm(strFieldName)

^

Este é o código:

<%

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)

Set fso = CreateObject("Scripting.FileSystemObject")

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

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

function ParseForm(strFieldName) 'Linha 50

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

%>

Valeu.

Editado por cyberalexxx
Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...