Ir para conteúdo

Arquivado

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

hudsonalves

Mais de uma foto por upload no Access

Recommended Posts

Voces conhecem uma forma de multiplos envios de fotos (upload) com access?

 

Tenho uma tabela chamada cadastro com 4 colunas: nome, sobrenome, email e foto.

 

Consigo fazer o cadastro e incluir apenas uma foto, é possível incluir diversas fotos nesta tabela? Voces conhecem algo parecido?

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olha estes exemplos:

<%
' senha é "Admin"
IntPass = "admin"
Pupload = "upload"
Response.Buffer = True
Response.Clear
Dim Name,Password,Login
If Not Session("Open") = "True" then%>
<title>Multiple File Uploads</title>
<BODY bgcolor=#3366CC onLoad="window.Introd.PassW.focus();">
<FORM name="Introd" method="post" action="<%=RedirName%>">
<table align=left border="1" bordercolor="#000000" cellspacing="0" cellpadding="0" width=250 bgcolor="#800000" style="border-collapse: collapse">
<tr><td align="center">
<P><font color="#FFFFFF"><font class=normal>Senha:</font> </font><input type=password name=PassW ID=PassW size=8> <input type=submit class=boton2 name=Entrar ID=Entrar value=" Enter "></P>
</td></tr></table></form><br><br><br>
<p align=left style="font-family:verdana,helvetica,arial,sans serif;color:#000000;font-size:8pt;font-weight:bold;"><%= date%></p>
</BODY></HTML>
<%	Session("Open") = "True"
	Response.End
else
	if Session("Enter") = "1" then
	else	
		Login = "True"
		Password = Request.Form("Passw")
		If not Password = IntPass then Login= "False"
		If Login= "False" then
			Session.Abandon
			Response.Write "Senha Invalida!!! <A HREF=""javascript:history.back(1)"">tente novamente."
			Response.End
		else
			Session("Enter") = "1"
				end if
	end if
End If
Sub BuildUploadRequest(RequestBin)
  
 
  if PosEnd = 0 then
  
    Response.Write "Porfavor verifique o formulário de uploads e tente novamente."
    Response.End
  end if
  boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
  boundaryPos = InstrB(1,RequestBin,boundary)
  
  Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
    'variável Members são colocadas em um objeto de dicionário
    Dim UploadControl
    Set UploadControl = CreateObject("Scripting.Dictionary")
    'Obter nome de objeto
    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))
      FileName = Mid(FileName,InStrRev(FileName,"\")+1)
   
      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 = FileName
      ValueBeg = PosBeg-1
      ValueLen = 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))
      ValueBeg = 0
      ValueEnd = 0
    End If

    UploadControl.Add "Value" , Value	
    UploadControl.Add "ValueBeg" , ValueBeg
    UploadControl.Add "ValueLen" , ValueLen	

    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

Function UploadFormRequest(name)
  on error resume next
  if UploadRequest.Item(name) then
    UploadFormRequest = UploadRequest.Item(name).Item("Value")
  end if  
End Function


UploadQueryString = Replace(Request.QueryString,"serverup=true","")
if mid(UploadQueryString,1,1) = "&" then
	UploadQueryString = Mid(UploadQueryString,2)
end if

serverupAction = CStr(Request.ServerVariables("URL")) & "?serverup=true"
If (Request.QueryString <> "") Then  
  if UploadQueryString <> "" then
	  serverupAction = serverupAction & "&" & UploadQueryString
  end if 
End If

If (CStr(Request.QueryString("serverup")) <> "") Then
 
  If (AF_redirectPage = "") Then
    AF_redirectPage = CStr(Request.ServerVariables("URL"))
  end if
    
  RequestBin = Request.BinaryRead(Request.TotalBytes)
  Dim UploadRequest
  Set UploadRequest = CreateObject("Scripting.Dictionary")  
  BuildUploadRequest RequestBin
  
  AF_keys = UploadRequest.Keys
  for AF_i = 0 to UploadRequest.Count - 1
    AF_curKey = AF_keys(AF_i)
 
    if UploadRequest.Item(AF_curKey).Item("FileName") <> "" then
      AF_value = UploadRequest.Item(AF_curKey).Item("Value")
      AF_valueBeg = UploadRequest.Item(AF_curKey).Item("ValueBeg")
      AF_valueLen = UploadRequest.Item(AF_curKey).Item("ValueLen")

      if AF_valueLen = 0 then
        Response.Write "<B>Ocorreu um erro ao salvar o arquivo carregado!</B><br><br>"
        Response.Write "Nome do arquivo: " & Trim(AF_curPath) & UploadRequest.Item(AF_curKey).Item("FileName") & "<br>"
        Response.Write "O arquivo não existe ou está vazio.<br>"
        Response.Write "Porfavor verifique <A HREF=""javascript:history.back(1)"">e tente novamente</a>"
	  	  response.End
	    end if
      
     
      Dim AF_strm1, AF_strm2
      Set AF_strm1 = Server.CreateObject("ADODB.Stream")
      Set AF_strm2 = Server.CreateObject("ADODB.Stream")
      

      AF_strm1.Open
      AF_strm1.Type = 1 'Binario
      AF_strm2.Open
      AF_strm2.Type = 1 'Binario
        
      AF_strm1.Write RequestBin
      AF_strm1.Position = AF_ValueBeg
      AF_strm1.CopyTo AF_strm2,AF_ValueLen
    
    
      AF_curPath = Request.ServerVariables("PATH_INFO")
      AF_curPath = Trim(Mid(AF_curPath,1,InStrRev(AF_curPath,"/")) & "")
      if Mid(AF_curPath,Len(AF_curPath),1) <> "/" then
        AF_curPath = AF_curPath & "/"
      end if  
      on error resume next
      AF_strm2.SaveToFile Trim(Server.mappath(AF_curPath))& "\" & UploadRequest.Item(AF_curKey).Item("FileName"),2
      if err then
        Response.Write "<B>Ocorreu um erro ao salvar o arquivo carregado!</B><br><br>"
        Response.Write "Nome do arquivo: " & Trim(AF_curPath) & UploadRequest.Item(AF_curKey).Item("FileName") & "<br>"
        Response.Write "Talvez o diretório de destino não existe, ou você não tem permissão de escrita.<br>"
        Response.Write "Porfavor verifique <A HREF=""javascript:history.back(1)"">e tente novamente</b></font></a>"
  		  err.clear
	  	  response.End
	    end if
    end if
  next
  
 
  If (AF_redirectPage <> "") Then
    If (InStr(1, AF_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
      AF_redirectPage = AF_redirectPage & "?" & UploadQueryString
    End If
    Call Response.Redirect(AF_redirectPage)  
  end if  

end if  
if UploadQueryString <> "" then
  UploadQueryString = UploadQueryString & "&serverup=true"
else  
  UploadQueryString = "serverup=true"
end if  

%>
<html>
<head>
<title>Multiple File Uploads</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--

function getFileExtension(filePath) { //v1.0
  fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
  return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}

function checkFileUpload(form,extensions) { //v1.0
  document.MM_returnValue = true;
  if (extensions && extensions != '') {
    for (var i = 0; i<form.elements.length; i++) {
      field = form.elements[i];
      if (field.type.toUpperCase() != 'FILE') continue;
      if (field.value == '') {
        alert('File is required!');
        document.MM_returnValue = false;field.focus();break;
      }
      if (extensions.toUpperCase().indexOf(getFileExtension(field.value).toUpperCase()) == -1) {
        alert('This file is not allowed for uploading!');
        document.MM_returnValue = false;field.focus();break;
  } } }
}
//-->
</script>
</head>
<body bgcolor="#3366CC" text="#800000">
<table width="450" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td> 
      <form name="ASP" method="post" action="<%=serverupAction%>" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'');return document.MM_returnValue">
        <div align="center"> 
          <input type="file" name="Files" size="20"> 
          <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"> </font><input type="file" name="Files1" size="20">  </p>
          <p> 
          <input type="file" name="Files2" size="20">  </p>
          <p> 
          <input type="file" name="Files3" size="20">  </p>
          <p> 
          <input type="file" name="Files4" size="20">  </p>
          <p> 
          <input type="file" name="Files5" size="20">  </p>
          <p> 
          <input type="file" name="Files6" size="20">  </p>
          <p> 
          <input type="file" name="Files7" size="20">  </p>
          <p><input type="reset" value="Reset" name="B1"><input type="submit" name="Submit" value="Upload"></div>
      </form>
    </td>
  </tr>
</table>
</body>
</html>

e aqui com o Upload de múltiplos arquivos com JQuery

Primeiro iremos usar o formulário para a seleção de arquivos.

formhtml
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title> Formulário </title>
        <meta name="Generator" content="EditPlus">
        <meta name="Author" content="">
        <meta name="Keywords" content="">
        <meta name="Description" content="">

    </head>

    <body>

        <!-- Preparações para o Uploadify -->
        <script type="text/javascript" src="uploadify/jquery-1.4.4.min.js"></script>
        <script type="text/javascript" src="uploadify/swfobject.js"></script>
        <script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.0.min.js"></script>
        <link rel="stylesheet" href="uploadify/styles/uploadify.css" type="text/css" media="all" title="all" charset="iso-8859-1" />


        <!-- Form -->
        <form id="novoArquivo" action="envio.asp" method="post">
            <div id="fileNameList">
                <pre id="fileInfo"></pre>
                <a id="lnkExclui" href="#">Excluir</a>
            </div>
            <div id="fileUpload">
                <input id="fileInput" name="fileInputs" type="file" />
            </div>
        </form>

        <!-- A 'mágica' -->
        <script type="text/javascript">

            //--------------------------------------------------------------------------------------------
            var respData; //Variável que armazena os dados de retorno de cada upload

            //As variáveis a seguir são alimentadas na função onComplete
            //e utilizadas na função onAllComplete
            var numArquivos = 0;            //Indica quantos arquivos foram enviados
            var nomeOriginal = new Array();    //Array com o NOME ORIGINAL de cada arquivo enviado
            var nomeArquivo = new Array();    //Array com o NOME ALTERADO de cada arquivo enviado
            var tamArquivo = new Array();    //Array com o TAMANHO de cada arquivo enviado
            var statusArquivo = new Array();//Array com o STATUS DE ENVIO de cada arquivo



            //--------------------------------------------------------------------------------------------
            //Esta função será chamada no final de todo o envio
            var onAllComplete = function(event, data) {

                //Limpa o local para apresentar os dados
                $('#fileInfo').html('');

               
                //Apresenta as informações de cada arquivo
                for (var nf = 1; nf <= numArquivos; nf++) {
                    $('#fileInfo').html(
                        $('#fileInfo').html() +
                        '<h2>Arquivo ' + nf + '</h2>' +
                        'Status de envio: <b>' + statusArquivo[nf] + '</b><br />' +
                        'Nome original do arquivo: <b>' + nomeOriginal[nf] + '</b><br />' +
                        'Nome do arquivo gravado: <b>' + nomeArquivo[nf] + '</b><br />' +
                        'Tamano do arquivo: <b>' + tamArquivo[nf] + '</b><br />' +
                        '<a href="uploads/' + nomeArquivo[nf] + '">Link para o arquivo</a><br /><br />'
                    );
                }

                //Esconde o botão e apresenta os dados do arquivo
                $('#fileNameList').show();
                $('#fileUpload').hide();
            }


            //--------------------------------------------------------------------------------------------
            //Esta função será chamada no final de CADA envio
            var onComplete = function(event, queueID, fileObj, response, data) {

                respData = $.parseJSON(response)

                //Incrementa o número de arquivos
                numArquivos++;

                //Armazena o status de envio (certamente 'OK')
                statusArquivo[numArquivos] = respData.result;

                //Se não houve erro no evio, armazena os dados do arquivo nos arrays
                if (respData.result != 'ERRO') {

                    nomeOriginal[numArquivos] =        respData.nomeOriginal;
                    nomeArquivo[numArquivos] =        respData.nomeArquivo;
                    tamArquivo[numArquivos] =        respData.tamArquivo;

                }
            }


            //--------------------------------------------------------------------------------------------
            //O link Excluir mostra novamente o botão de upload
            $('#lnkExclui').click(function(e) {
                $('#fileNameList').hide();
                $('#fileUpload').show();
                e.preventDefault;
                return false;
            });


            //--------------------------------------------------------------------------------------------
            //Preparação inicial
            $(document).ready(function() {
                //Configuração do uploadify
                $('#fileInput').uploadify({
                    'uploader'        : 'uploadify/uploadify.swf',        //Handler Flash para o upload
                    'script'        : 'envio.asp',                        //Página a ser chamada para tratar o upload
                    'cancelImg'        : 'uploadify/cancelUpload.png',        //Imagem do botão de cancelar (X)
                    'auto'            : true,                                //Envio se inicia ao selecionar o arquivo
                    'folder'        : '',                                //Pasta para envio (quem vai tratar isso é o ASP)
                    'buttonText'    : 'Procurar',                        //Texto do botão
                    'multi'            : true,                                //Permite o envio de vários arquivos
                    'onComplete'    : onComplete,                        //A função a ser chamada A CADA arquivo enviado (definida acima)
                    'onAllComplete'    : onAllComplete,                    //A função a ser chamada no fim de TODO o envio (definida acima)
                    'onSelectOnce'    : function(event,data) {            //Esta função serve apenas para zerar o número de arquivos enviados
                                        numArquivos = 0;                // no início do envio
                                      }
                });

                //Preparação para a primeira tela
                $('#fileNameList').hide();
                $('#fileUpload').show();
            });
        </script>



    </body>
</html>
[/code]

Abaixo a página de envio do upload, onde iremos a classe de Upload e a classe JSON.

envio.asp

[code]<!--#include file="classUpload/clsUpload.asp"-->
<!--#include file="classJson/JSON_2.0.4.asp"-->

<%

    '------------------------------------------------------------------------
    'Gera uma string aleatória com 'n' dígitos
    'Usado para criar um nome aleatório para o arquivo
    function fnGeraChave(n)
        dim s

        randomize
        s = ""
        while len(s) < n
            s = chr (int((57 - 48 + 1) * Rnd + 48)) + s
        wend
        fnGeraChave = s
    end function
    '------------------------------------------------------------------------

    Response.Charset="ISO-8859-1"

    dim objUp            'Instância da classe upload (definida no arquivo clsUpload.asp)
    dim objJson            'Instância da classe JSON (definida no arquivo JSON_2.0.4.asp)
    dim diretorio        'Diretório destino
    dim nomeOriginal    'Nome original do arquivo
    dim nomeArquivo        'Nome temporário do arquivo
                        '(Alterado para evitar que arquivos com mesmo nome se sobrescrevam)

    'Instancia a classe clsUpload
    set objUp = New clsUpload

    'Instancia a classe JSON (para enviar a resposta)
    Set objJson = jsObject()

    'Campos passados pelo Uploadify:
    '    - Filename    Nome original do arquivo enviado
    '    - folder    Este campo é definido pelo parâmetro 'folder' do uploadify - não estamos usando
    '    - Filedata    Os bytes (stream) que compõem o arquivo
    '    - Upload    Só achei o valor 'Submit Query' neste campo

    if objUp.fields("Filedata").length <> 0 and objUp.fields("Filedata").length & "" <> "" then

        nomeOriginal = objUp.fields("Filename").value
        nomeArquivo = fnGeraChave(20) & "_" & nomeOriginal

        'O diretório destino é definido aqui, como pasta filha 'uploads' da pasta atual
        diretorio = request.serverVariables("PATH_TRANSLATED")
        diretorio = left (diretorio,instrRev(diretorio,"\")) & "uploads\"

        'Salva o arquivo (Lembre-se de dar direito de escrita para o usuário IUSR!)
        objUp.fields("Filedata").saveAs(diretorio & nomeArquivo)


        'Envia os dados do arquivo via JSON (pode ser que você precise deles no outro lado)
        objJson("result") = "OK"
        objJson("nomeArquivo") = nomeArquivo
        objJson("tamArquivo") = objUp.fields("Filedata").length
        objJson("nomeOriginal") = nomeOriginal

    else
        'Ocorreu um erro no envio
        objJson("result") = "ERRO"
    end if

    'Envia o JSON para o cliente
    objJson.flush

    'Destroi as instâncias
    Set objUp = Nothing
    Set objJson = Nothing

%>[/code]

A classe JSON_2.0.4 e a classe de Upload podem ser baixadas aqui, lembrando que será preciso criar uma pasta chamada classjson e uma pasta chamada classupload, após você terá que criar uma pasta chamada uploads , é nesta pasta, onde ficarão os arquivos que forem enviados para o servidor. Lembre-se de que o usuário IUSR precisa de direito de escrita nele.

JSON_2.0.4.asp
[code]<%
'
'    VBS JSON 2.0.3
'    Copyright (c) 2009 Tuðrul Topuz
'    Under the MIT (MIT-LICENSE.txt) license.
'

Const JSON_OBJECT    = 0
Const JSON_ARRAY    = 1

Class jsCore
    Public Collection
    Public Count
    Public QuotedVars
    Public Kind ' 0 = object, 1 = array

    Private Sub Class_Initialize
        Set Collection = CreateObject("Scripting.Dictionary")
        QuotedVars = True
        Count = 0
    End Sub

    Private Sub Class_Terminate
        Set Collection = Nothing
    End Sub

    ' counter
    Private Property Get Counter
        Counter = Count
        Count = Count + 1
    End Property

    ' - data maluplation
    ' -- pair
    Public Property Let Pair(p, v)
        If IsNull(p) Then p = Counter
        Collection(p) = v
    End Property

    Public Property Set Pair(p, v)
        If IsNull(p) Then p = Counter
        If TypeName(v) <> "jsCore" Then
            Err.Raise &hD, "class: class", "Incompatible types: '" & TypeName(v) & "'"
        End If
        Set Collection(p) = v
    End Property

    Public Default Property Get Pair(p)
        If IsNull(p) Then p = Count - 1
        If IsObject(Collection(p)) Then
            Set Pair = Collection(p)
        Else
            Pair = Collection(p)
        End If
    End Property
    ' -- pair
    Public Sub Clean
        Collection.RemoveAll
    End Sub

    Public Sub Remove(vProp)
        Collection.Remove vProp
    End Sub
    ' data maluplation

    ' encoding
    Function jsEncode(str)
        Dim charmap(127), haystack()
        charmap(8)  = "\b"
        charmap(9)  = "\t"
        charmap(10) = "\n"
        charmap(12) = "\f"
        charmap(13) = "\r"
        charmap(34) = "\"""
        charmap(47) = "\/"
        charmap(92) = "\\"

        Dim strlen : strlen = Len(str) - 1
        ReDim haystack(strlen)

        Dim i, charcode
        For i = 0 To strlen
            haystack(i) = Mid(str, i + 1, 1)

            charcode = AscW(haystack(i)) And 65535
            If charcode < 127 Then
                If Not IsEmpty(charmap(charcode)) Then
                    haystack(i) = charmap(charcode)
                ElseIf charcode < 32 Then
                    haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
                End If
            Else
                haystack(i) = "\u" & Right("000" & Hex(charcode), 4)
            End If
        Next

        jsEncode = Join(haystack, "")
    End Function

    ' converting
    Public Function toJSON(vPair)
        Select Case VarType(vPair)
            Case 0    ' Empty
                toJSON = "null"
            Case 1    ' Null
                toJSON = "null"
            Case 7    ' Date
                ' toJSON = "new Date(" & (vPair - CDate(25569)) * 86400000 & ")"    ' let in only utc time
                toJSON = """" & CStr(vPair) & """"
            Case 8    ' String
                toJSON = """" & jsEncode(vPair) & """"
            Case 9    ' Object
                Dim bFI,i
                bFI = True
                If vPair.Kind Then toJSON = toJSON & "[" Else toJSON = toJSON & "{"
                For Each i In vPair.Collection
                    If bFI Then bFI = False Else toJSON = toJSON & ","

                    If vPair.Kind Then
                        toJSON = toJSON & toJSON(vPair(i))
                    Else
                        If QuotedVars Then
                            toJSON = toJSON & """" & i & """:" & toJSON(vPair(i))
                        Else
                            toJSON = toJSON & i & ":" & toJSON(vPair(i))
                        End If
                    End If
                Next
                If vPair.Kind Then toJSON = toJSON & "]" Else toJSON = toJSON & "}"
            Case 11
                If vPair Then toJSON = "true" Else toJSON = "false"
            Case 12, 8192, 8204
                toJSON = RenderArray(vPair, 1, "")
            Case Else
                toJSON = Replace(vPair, ",", ".")
        End select
    End Function

    Function RenderArray(arr, depth, parent)
        Dim first : first = LBound(arr, depth)
        Dim last : last = UBound(arr, depth)

        Dim index, rendered
        Dim limiter : limiter = ","

        RenderArray = "["
        For index = first To last
            If index = last Then
                limiter = ""
            End If

            On Error Resume Next
            rendered = RenderArray(arr, depth + 1, parent & index & "," )

            If Err = 9 Then
                On Error GoTo 0
                RenderArray = RenderArray & toJSON(Eval("arr(" & parent & index & ")")) & limiter
            Else
                RenderArray = RenderArray & rendered & "" & limiter
            End If
        Next
        RenderArray = RenderArray & "]"
    End Function

    Public Property Get jsString
        jsString = toJSON(Me)
    End Property

    Sub Flush
        If TypeName(Response) <> "Empty" Then
            Response.Write(jsString)
        ElseIf WScript <> Empty Then
            WScript.Echo(jsString)
        End If
    End Sub

    Public Function Clone
        Set Clone = ColClone(Me)
    End Function

    Private Function ColClone(core)
        Dim jsc, i
        Set jsc = new jsCore
        jsc.Kind = core.Kind
        For Each i In core.Collection
            If IsObject(core(i)) Then
                Set jsc(i) = ColClone(core(i))
            Else
                jsc(i) = core(i)
            End If
        Next
        Set ColClone = jsc
    End Function

End Class

Function jsObject
    Set jsObject = new jsCore
    jsObject.Kind = JSON_OBJECT
End Function

Function jsArray
    Set jsArray = new jsCore
    jsArray.Kind = JSON_ARRAY
End Function

Function toJSON(val)
    toJSON = (new jsCore).toJSON(val)
End Function
%>[/code] 

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.