Ir para conteúdo

POWERED BY:

Arquivado

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

calcio

Sistema de UPLOAD

Recommended Posts

galera tenho um sistema de UPLOAD no sites ele funciona na boa porem quando eu copio para outra pasta dos site pra fazer outro UPLOAD ele dá pau.. o erro exibido é esse:

 

Alguém pode me ajudar tem tem sentido essa bosta funcionar num lugar e ñ funcionar em outro...

 

Path Not found...

Veja.

 

The page cannot be displayed

There is a problem with the page you are trying to reach and it cannot be displayed.

 

--------------------------------------------------------------------------------

 

Please try the following:

 

Click the Refresh button, or try again later.

 

Open the localhost home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error

Internet Information Services

 

--------------------------------------------------------------------------------

 

Technical Information (for support personnel)

 

Error Type:

Microsoft vb script:window.open('enviaArquivo.asp?arquivo=txtArquivo','','width=320,height=90');void(0);">Enviar arquivo</a></strong></font><br>

<font size="2" face="Verdana, Arial"><strong>ex: arquivo.txt, arquivo.doc,

etc. </strong></font></p></td>

</tr>

<tr>

<td> </td>

<td><input name="btCadastrar" type="submit" id="btCadastrar" value="Cadastrar"></td>

</tr>

</table>

</form>

 

enviaArquivo.asp

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

<table width="75%" border="0">

<tr>

<td width="17%"><strong><font size="2" face="Verdana, Arial">Arquivo:</font></strong></td>

<td width="83%"><input name="blob" type="file" id="blob" size="20" maxlength="255"></td>

</tr>

<tr>

<td> </td>

<td><input name="Enter" type="submit" value="Enviar Arquivo">

<input name="pasta" type="hidden" id="pasta" value="<%=request.Form("arquivo")%>"><br>

</td>

</tr>

</table>

</FORM>

 

gravaArquivo.asp

<%

Response.Expires=0

Response.Clear

 

'Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))

 

byteCount = Request.TotalBytes

 

'Response.BinaryWrite(Request.BinaryRead(varByteCount))

 

 

 

RequestBin = Request.BinaryRead(byteCount)

 

Dim UploadRequest

 

Set UploadRequest = CreateObject("Scripting.Dictionary")

 

 

 

BuildUploadRequest RequestBin

 

 

 

pasta1 = "resultado/arquivos/"

pasta = UploadRequest.Item("pasta").Item("Value")

contentType = UploadRequest.Item("blob").Item("ContentType")

 

filepathname = UploadRequest.Item("blob").Item("FileName")

 

filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))

 

value = UploadRequest.Item("blob").Item("Value")

 

 

 

'Create FileSytemObject Component

 

Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

 

 

 

'Create and Write to a File

 

pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14

 

Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&pasta&"/"&filename)

 

 

 

For i = 1 to LenB(value)

 

MyFile.Write chr(AscB(MidB(value,i,1)))

 

Next

 

 

 

MyFile.Close

 

%>

<!--#include file="upload.asp"-->

<html>

<head><Title>Enviado com Sucesso!</title></head>

<body bgcolor="#FFFFFF" onunload="java script:window.opener.form.<%=pasta%>.value='<%=filename%>';" onload="java script:window.close();">

 

<p align="center">Nome do Arquivo:<font color="#FF0000"><%=" "%><%=filename%></font><br>

 

Operação realizada com sucesso!!!!</p>

 

<p align="center"> <a href="java script:window.close();">Fechar</a>

 

</body></html>

 

upload.asp

<%

Sub BuildUploadRequest(RequestBin)

 

'Get the boundary

 

PosBeg = 1

 

PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))

 

boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)

 

boundaryPos = InstrB(1,RequestBin,boundary)

 

'Get all data inside the boundaries

 

Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))

 

'Members variable of objects are put in a dictionary object

 

Dim UploadControl

 

Set UploadControl = CreateObject("Scripting.Dictionary")

 

'Get an object name

 

Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))

 

Pos = InstrB(Pos,RequestBin,getByteString("name="))

 

PosBeg = Pos+6

 

PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))

 

Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

 

PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename="))

 

PosBound = InstrB(PosEnd,RequestBin,boundary)

 

'Test if object is of file type

 

If PosFile<>0 AND (PosFile<PosBound) Then

 

'Get Filename, content-type and content of file

 

PosBeg = PosFile + 10

 

PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))

 

FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

 

'Add filename to dictionary object

 

UploadControl.Add "FileName", FileName

 

Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))

 

PosBeg = Pos+14

 

PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))

 

'Add content-type to dictionary object

 

ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

 

UploadControl.Add "ContentType",ContentType

 

'Get content of object

 

PosBeg = PosEnd+4

 

PosEnd = InstrB(PosBeg,RequestBin,boundary)-2

 

Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)

 

Else

 

'Get content of object

 

Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))

 

PosBeg = Pos+4

 

PosEnd = InstrB(PosBeg,RequestBin,boundary)-2

 

Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))

 

End If

 

'Add content to dictionary object

 

UploadControl.Add "Value" , Value

 

'Add dictionary object to main dictionary

 

UploadRequest.Add name, UploadControl

 

'Loop to next object

 

BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)

 

Loop

 

 

 

End Sub

 

 

 

'String to byte string conversion

 

Function getByteString(StringStr)

 

For i = 1 to Len(StringStr)

 

char = Mid(StringStr,i,1)

 

getByteString = getByteString & chrB(AscB(char))

 

Next

 

End Function

 

 

 

'Byte string to string conversion

 

Function getString(StringBin)

 

getString =""

 

For intCount = 1 to LenB(StringBin)

 

getString = getString & chr(AscB(MidB(StringBin,intCount,1)))

 

Next

 

End Function

%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Verifica se o valor dessa variável está correto para a nova pasta para onde você moveu o sistema, e se você tem permissão de ecrita na mesma.

 

pasta1 = "resultado/arquivos/"

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.