Ir para conteúdo

POWERED BY:

Arquivado

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

No Limite!!!

fso - upload

Recommended Posts

como esta fazendo a parada??

Compartilhar este post


Link para o post
Compartilhar em outros sites

como esta fazendo a parada??

<{POST_SNAPBACK}>

Segue script com a funcão de upload do componente FSO:

 

<%

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)

 

Nome = split(FileName,".")

if Nome(1) <> "" then FileName = Nome(1)

FileName = ArqNome&"."&FileName

 

dir2 = "geral"

 

Set fso = CreateObject("Scripting.FileSystemObject")

' FileName = ArqNome

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

end if

%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

qual erro que dá no outro computador??o FSO esta habilitado??

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.