Ir para conteúdo

POWERED BY:

Arquivado

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

apeironcad

como coloco na WEB -

Recommended Posts

tenho um upload q funciona normalmente no pws mas num servidor dá erro de patho servidor q é pago tem suporte a FSOnão entendi o pq do erroMicrosoft VBScript runtime error '800a004c' Path not found /cd/upcd.inc, line 263 ______________________________o codigo e esseup_cd.asp - formulario

<html><head><title>Upload de fichier</title><link href="../form.css" rel="stylesheet" type="text/css"></head><body><form method=post ENCTYPE="multipart/form-data" class="free"><br><table width="47%" border="0" align="center" cellpadding="0" cellspacing="0"><tr> <td width="1%"> </td><td width="77%" class="free">Arquivo : <input name="File1" type="file" class="form" > </td><td width="22%"><input name="Action" type="submit" class="form" value="Enviar"></td></tr></table><div align="center"></div><div align="center"></div></form></body></HTML><!---#INCLUDE FILE="upcd.inc" ---><%'Sauvegarde le fichier 'File1' sur le serveur dans le même répertoire que ce script'Modifier le FilePath pour le claquer ailleursIf Request.ServerVariables("REQUEST_METHOD") = "POST" Then 'Request method must be "POST" For get the fieldsSet Fields = GetUpload()FilePath = Server.MapPath(".") & "../" & Fields("File1").FileNameFields("File1").Value.SaveAs FilePathEnd If%>

e o codigo é esse do upcd com o script

<script RUNAT=SERVER LANGUAGE=VBSCRIPT>Const IncludeType = 2'Vous pouvez utiliser ce composant d'upload pourr :' 1. Uploader de petits fichiers sur le serveur (sauvegarde via les FileSystem object)' 2. Uploader des fichiers binaires/texte de n'importe quelle taille sur une base de données serveur (RS("BinField") = Upload("FormField").Value)'restriction de la taille de l'uploadDim UploadSizeLimit'********************************** Méthode GetUpload **********************************'Cette fonction lit les champs de formulaires en entrée binaire et les renvoie en tant qu'objet du dictionnaire.Function GetUpload()Dim ResultSet Result = NothingIf Request.ServerVariables("REQUEST_METHOD") = "POST" Then 'la méthode REQUEST doit être POSTDim CT, PosB, Boundary, Length, PosECT = Request.ServerVariables("HTTP_Content_Type") ' lit le headerIf LCase(Left(CT, 19)) = "multipart/form-data" Then 'qui doit être de type "multipart/form-data"PosB = InStr(LCase(CT), "boundary=") 'Finds boundaryIf PosB > 0 Then Boundary = Mid(CT, PosB + 9) 'Separetes boundary'****** Erreur sur IE5.01 - doublement des entêtes httpPosB = InStr(LCase(CT), "boundary=") If PosB > 0 then 'Patch pour l'erreur IEPosB = InStr(Boundary, ",")If PosB > 0 Then Boundary = Left(Boundary, PosB - 1)end if'****** Erreur sur IE5.01 - doublement des entêtes httpLength = CLng(Request.ServerVariables("HTTP_Content_Length"))If "" & UploadSizeLimit <> "" ThenUploadSizeLimit = CLng(UploadSizeLimit)If Length > UploadSizeLimit ThenRequest.BinaryRead (Length)Err.Raise 2, "GetUpload", "Upload size " & FormatNumber(Length, 0) & "B exceeds limit of " & FormatNumber(UploadSizeLimit, 0) & "B"Exit FunctionEnd IfEnd IfIf Length > 0 And Boundary <> "" Then Boundary = "--" & BoundaryDim Head, BinaryBinary = Request.BinaryRead(Length) 'lit les données à partir du poste clientSet Result = SeparateFields(Binary, Boundary)Binary = Empty 'Mise à jour des variablesElseErr.Raise 10, "GetUpload", "longueur nulle ."End IfElseErr.Raise 11, "GetUpload", "Pas de fichier joint."End IfElseErr.Raise 1, "GetUpload", "Mauvaise méthode de request."End IfSet GetUpload = ResultEnd Function'********************************** SeparateFields **********************************Function SeparateFields(Binary, Boundary)Dim PosOpenBoundary, PosCloseBoundary, PosEndOfHeader, isLastBoundaryDim FieldsBoundary = StringToBinary(Boundary)PosOpenBoundary = InStrB(Binary, Boundary)PosCloseBoundary = InStrB(PosOpenBoundary + LenB(Boundary), Binary, Boundary, 0)Set Fields = CreateObject("Scripting.Dictionary")Do While (PosOpenBoundary > 0 And PosCloseBoundary > 0 And Not isLastBoundary)'Entête et fichier sourceDim HeaderContent, FieldContent, bFieldContent'entêtesDim Content_Disposition, FormFieldName, SourceFileName, Content_Type'variableDim Field, TwoCharsAfterEndBoundary'Fin de l'entêtePosEndOfHeader = InStrB(PosOpenBoundary + Len(Boundary), Binary, StringToBinary(vbCrLf + vbCrLf))'Séparation des champs de l'entêterHeaderContent = MidB(Binary, PosOpenBoundary + LenB(Boundary) + 2, PosEndOfHeader - PosOpenBoundary - LenB(Boundary) - 2)'séparation du contenubFieldContent = MidB(Binary, (PosEndOfHeader + 4), PosCloseBoundary - (PosEndOfHeader + 4) - 2)'séparation des champs d'entête de l'entêterGetHeadFields BinaryToString(HeaderContent), Content_Disposition, FormFieldName, SourceFileName, Content_Type'Creation d'un champs et attribution des paramètresSet Field = CreateUploadField()'See the JS function bellowSet FieldContent = CreateBinaryData(bFieldContent,LenB(bFieldContent))' FieldContent.ByteArray = bFieldContent' FieldContent.Length = LenB(bFieldContent)Field.Name = FormFieldNameField.ContentDisposition = Content_DispositionField.FilePath = SourceFileNameField.FileName = GetFileName(SourceFileName)Field.ContentType = Content_TypeField.Length = FieldContent.LengthSet Field.Value = FieldContent' response.write "<br>:" & FormFieldNameFields.Add FormFieldName, Field'Dernière borne ?TwoCharsAfterEndBoundary = BinaryToString(MidB(Binary, PosCloseBoundary + LenB(Boundary), 2))isLastBoundary = TwoCharsAfterEndBoundary = "--"If Not isLastBoundary Then 'Putain!!! Pas la dernière... on avance jusqu'au champ suivant.PosOpenBoundary = PosCloseBoundaryPosCloseBoundary = InStrB(PosOpenBoundary + LenB(Boundary), Binary, Boundary)End IfLoopSet SeparateFields = FieldsEnd Function'********************************** Utilities **********************************'Separation des champs d'entête de l'entête uploadéFunction GetHeadFields(ByVal Head, Content_Disposition, Name, FileName, Content_Type)Content_Disposition = LTrim(SeparateField(Head, "content-disposition:", ";"))Name = (SeparateField(Head, "name=", ";")) 'ltrimIf Left(Name, 1) = """" Then Name = Mid(Name, 2, Len(Name) - 2)FileName = (SeparateField(Head, "filename=", ";")) 'ltrimIf Left(FileName, 1) = """" Then FileName = Mid(FileName, 2, Len(FileName) - 2)Content_Type = LTrim(SeparateField(Head, "content-type:", ";"))End Function'Separation du champ entre sStart et sEndFunction SeparateField(From, ByVal sStart, ByVal sEnd)Dim PosB, PosE, sFromsFrom = LCase(From)PosB = InStr(sFrom, sStart)If PosB > 0 ThenPosB = PosB + Len(sStart)PosE = InStr(PosB, sFrom, sEnd)If PosE = 0 Then PosE = InStr(PosB, sFrom, vbCrLf)If PosE = 0 Then PosE = Len(sFrom) + 1SeparateField = Mid(From, PosB, PosE - PosB)ElseSeparateField = EmptyEnd IfEnd Function'Separation du nom de fichier du cheminFunction GetFileName(FullPath)Dim Pos, PosFPosF = 0For Pos = Len(FullPath) To 1 Step -1Select Case Mid(FullPath, Pos, 1)Case "/", "\": PosF = Pos + 1: Pos = 0End SelectNextIf PosF = 0 Then PosF = 1GetFileName = Mid(FullPath, PosF)End FunctionFunction BinaryToStringSimple(Binary)Dim I, SFor I = 1 To LenB(Binary)S = S & Chr(AscB(MidB(Binary, I, 1)))NextBinaryToStringSimple = SEnd FunctionFunction BinaryToString(Binary)' BinaryToString = RSBinaryToString(Binary)' Exit Functiondim cl1, cl2, cl3, pl1, pl2, pl3Dim L', nullcharcl1 = 1cl2 = 1cl3 = 1L = LenB(Binary)Do While cl1<=Lpl3 = pl3 & Chr(AscB(MidB(Binary,cl1,1)))cl1 = cl1 + 1cl3 = cl3 + 1if cl3>300 thenpl2 = pl2 & pl3pl3 = ""cl3 = 1cl2 = cl2 + 1if cl2>200 thenpl1 = pl1 & pl2pl2 = ""cl2 = 1End IfEnd IfLoopBinaryToString = pl1 & pl2 & pl3End FunctionFunction RSBinaryToString(xBinary)Dim Binaryif vartype(xBinary)=8 then Binary = MultiByteToBinary(xBinary) else Binary = xBinaryDim RS, LBinaryConst adLongVarChar = 201Set RS = CreateObject("ADODB.Recordset")LBinary = LenB(Binary)if LBinary>0 thenRS.Fields.Append "mBinary", adLongVarChar, LBinaryRS.OpenRS.AddNewRS("mBinary").AppendChunk Binary RS.UpdateRSBinaryToString = RS("mBinary")ElseRSBinaryToString = ""End IfEnd FunctionFunction MultiByteToBinary(MultiByte)Dim RS, LMultiByte, BinaryConst adLongVarBinary = 205Set RS = CreateObject("ADODB.Recordset")LMultiByte = LenB(MultiByte)if LMultiByte>0 thenRS.Fields.Append "mBinary", adLongVarBinary, LMultiByteRS.OpenRS.AddNewRS("mBinary").AppendChunk MultiByte & ChrB(0)RS.UpdateBinary = RS("mBinary").GetChunk(LMultiByte)End IfMultiByteToBinary = BinaryEnd FunctionFunction StringToBinary(String)Dim I, BFor I=1 to len(String)B = B & ChrB(Asc(Mid(String,I,1)))NextStringToBinary = BEnd FunctionFunction vbsSaveAs(FileName, ByteArray)Dim FS, TextStreamSet FS = CreateObject("Scripting.FileSystemObject")Set TextStream = FS.CreateTextFile(FileName) TextStream.Write BinaryToString(ByteArray) ' BinaryToString is in upload.inc.TextStream.CloseEnd Function</SCRIPT><script RUNAT=SERVER LANGUAGE=JSCRIPT>function CreateUploadField(){ return new uf_Init() }function uf_Init(){this.Name = nullthis.ContentDisposition = nullthis.FileName = nullthis.FilePath = nullthis.ContentType = nullthis.Value = nullthis.Length = null}function CreateBinaryData(Binary, mLength){ return new bin_Init(Binary, mLength) }function bin_Init(Binary, mLength){this.ByteArray = Binarythis.Length = mLengththis.String = BinaryToString(Binary)this.SaveAs = jsSaveAs}//function jsBinaryToString(){// return BinaryToString(this.ByteArray)//};function jsSaveAs(FileName){return vbsSaveAs(FileName, this.ByteArray)}//Simulate ByteArray class by JS/VBS - end</SCRIPT>

agradeço a ajuda :blink: :blink:

Compartilhar este post


Link para o post
Compartilhar em outros sites

Creio que basta você alterar o caminho para onde estão sendo enviados os arquivos do upload.Provavelmente o diretório é diferente do servidor, que é geralmente como d:\inetpub\seuwebsite.Valeu,

Compartilhar este post


Link para o post
Compartilhar em outros sites

olá, cara tenta ao invez de colocar o caminho usar o comando Server.MapPathbem melhor

Compartilhar este post


Link para o post
Compartilhar em outros sites

FilePath = Server.MapPath(".") & "../" & Fields("File1").FileName

Dá um print no FilePath pra ver o que ele tá retornando... e posta aqui pra nóis.

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.