Jump to content
Fórum Script Brasil
  • 0

Mais De Um Anexo?


Patricia Guido
 Share

Question

4 answers to this question

Recommended Posts

  • 0

posta seu código de upload pra gente verificar

segue ex.:

Na hora de salvar os arquivos faz assim

For each file In mySmartUpload.Files

    If not file.IsMissing Then

        vNomeArq = file.FileName 
       file.SaveAs(PastaDestino & vNomeArq)
        vCaminho = (PastaDestino & vNomeArq)
        
   End If
Next

Link to comment
Share on other sites

  • 0

oi...desculpa a demora

esse é o para enviar

<!-- #include file = "funcoes_upload.asp" -->
<!--#include file="conectando.asp"-->
<%
'Chamando Funções, que fazem o Upload funcionar
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin

' Tempo de finalização do script
Server.ScriptTimeout = 180

' Tipo de arquivo que esta sendo enviado
tipo_arquivo = UploadRequest.Item("arquivo").Item("ContentType")

' Caminho completo dos arquivos enviados
caminho_arquivo = UploadRequest.Item("arquivo").Item("FileName")

' Nome dos arquivos enviados
nome_arquivo = Right(caminho_arquivo,Len(caminho_arquivo)-InstrRev(caminho_arquivo,"\"))

' Conteudo binario dos arquivos enviados
arquivo = UploadRequest.Item("arquivo").Item("Value")

'pasta onde as imagens serao guardadas
pasta = Server.MapPath("obras/")
nome_arquivo = "/"&nome_arquivo

' pasta + nome dos arquivos
Varquivo = "obras" + nome_arquivo

' Fazendo o Upload do arquivo selecionado
if Varquivo <> "" then
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
Set MyFile = ScriptObject.CreateTextFile(pasta & nome_arquivo)
For i = 1 to LenB(arquivo)
MyFile.Write chr(AscB(MidB(arquivo,i,1)))
Next
MyFile.Close
end if
e esse é o funcoes upload
<%
' Upload Sem componentes ---------------------------------------
Sub BuildUploadRequest(RequestBin)
on error resume next

PosBeg = 1
PosEnd = InStrB(PosBeg, RequestBin, getByteString(Chr(13)))
boundary = MidB(RequestBin, PosBeg, PosEnd - PosBeg)
BoundaryPos = InStrB(1, RequestBin, boundary)

Do Until (BoundaryPos = InStrB(RequestBin, boundary & getByteString("--")))

Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")

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)

If PosFile <> 0 And (PosFile < PosBound) Then
PosBeg = PosFile + 10
PosEnd = InStrB(PosBeg, RequestBin, getByteString(Chr(34)))
FileName = getString(MidB(RequestBin, PosBeg, PosEnd - PosBeg))
UploadControl.Add "FileName", FileName
Pos = InStrB(PosEnd, RequestBin, getByteString("Content-Type:"))
PosBeg = Pos + 14
PosEnd = InStrB(PosBeg, RequestBin, getByteString(Chr(13)))
ContentType = getString(MidB(RequestBin, PosBeg, PosEnd - PosBeg))
UploadControl.Add "ContentType", ContentType
PosBeg = PosEnd + 4
PosEnd = InStrB(PosBeg, RequestBin, boundary) - 2
Value = MidB(RequestBin, PosBeg, PosEnd - PosBeg)
Else
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

UploadControl.Add "Value", Value
UploadRequest.Add Name, UploadControl
BoundaryPos = InStrB(BoundaryPos + LenB(boundary), RequestBin, boundary)
Loop
End Sub

Function getByteString(StringStr)
For i = 1 To Len(StringStr)
Char = Mid(StringStr, i, 1)
getByteString = getByteString & ChrB(AscB(Char))
Next
End Function

Function getString(StringBin)
getString = ""
For intCount = 1 To LenB(StringBin)
getString = getString & Chr(AscB(MidB(StringBin, intCount, 1)))
Next
End Function

' Fim upload sem Componentes -----------------------------------------
%>

acho que a mina que fez copiou ate aqui do forum

obrigada

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.5k
×
×
  • Create New...