03-20-2009 01:33 PM
03-23-2009 07:05 AM
03-23-2009 08:35 AM
dim boundaryString
dim boundary
dim requestbody
dim creds
dim Base64Encode
creds = "admin" & ":" & "admin"
Const adTypeText = 2
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream 'As New Stream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save text/string data.
BinaryStream.Type = adTypeText
'Specify charset For the source text (unicode) data.
BinaryStream.CharSet = "us-ascii"
'Open the stream And write text/string data To the object
BinaryStream.Open
BinaryStream.WriteText creds
'Change stream type To binary
BinaryStream.Position = 0
BinaryStream.Type = adTypeBinary
'Ignore first two bytes - sign of
BinaryStream.Position = 0
'Open the stream And get binary data from the object
' Stream_StringToBinary = BinaryStream.Read
Dim dom: Set dom = CreateObject("MSXML2.DOMDocument.3.0")
Dim elem: Set elem = dom.appendChild(dom.createElement("root"))
elem.dataType = "bin.base64"
elem.nodeTypedValue = BinaryStream.Read
Base64Encode = elem.Text
dim http_request
Set http_request = CreateObject("Msxml2.XMLHTTP")
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile("c:\\teste.bmp")
boundarystr = "—————————7d92a4b1705ba"
boundary = "—————————–7d92a4b1705ba"
requestbody = boundary & VbCrlf
requestbody = requestbody & "Content-Disposition: form-data; name=""file""; filename=""C:\Documents and Settings\demo\Ambiente de trabalho\teste.bmp""" & VbCrlf
requestbody = requestbody & "Content-Type: application/octet-stream" & VbCrlf & VbCrlf & escape(objStream.Read) & VbCrlf & boundary & VbCrlf
' "http://office.microsoft.com/pt-pt/outlook/CH101030382070.aspx" & VbCrlf & boundary & VbCrlf
'escape(objStream.Read) & VbCrlf & boundary & VbCrlf
requestbody = requestbody & "Content-Disposition: form-data; name=""title""" & VbCrLf & VbCrLf
requestbody = requestbody & "txt" & VbCrLf & boundary & VbCrlf
requestbody = requestbody & "Content-Disposition: form-data; name=""desc""" & VbCrLf & VbCrLf
requestbody = requestbody & "site" & VbCrLf & boundary & VbCrlf
requestbody = requestbody & "Content-Disposition: form-data; name=""submit""" & VbCrLf & VbCrLf
requestbody = requestbody & "Upload" & VbCrLf & boundary & "–" & VbCrLf
http_request.open "POST", "http://10.0.0.13:8080/alfresco/service/sample/upload", true
http_request.setRequestHeader "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
http_request.setRequestHeader "Content-length", len(requestbody)
http_request.setRequestHeader "Connection", "Keep-Alive"
http_request.setRequestHeader "Content-type", "multipart/form-data; boundary=" & boundarystr
http_request.setRequestHeader "Authorization", "Basic " & Base64Encode
http_request.send requestbody
03-24-2009 07:29 AM
03-24-2009 01:13 PM
04-01-2009 11:04 AM
04-02-2009 02:46 AM
04-02-2009 04:20 AM
04-06-2009 06:29 AM
06-15-2009 06:24 AM
fileName = fso.BuildPath(folderName, justfile & ".txt")
Set txtFile = fso.CreateTextFile(fileName, True)
txtFile.WriteLine "Empresa: " & me.Field( "Section1\Company" ).Value
txtFile.WriteLine "Contribuinte Externo: " & me.Field( "Section1\VatID" ).Value
txtFile.WriteLine "Data de Emissão: " & me.Field( "Section1\Date" ).Value
txtFile.WriteLine "Numero de Factura: " & me.Field( "Section1\InvoiceNumber" ).Value
txtFile.WriteLine "Total: " & me.Field( "Section1\Total" ).Value
txtFile.Close
set objStream = Nothing
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile(fileName)
set oXMLHttp = CreateObject("microsoft.xmlhttp")
If sUserName <> "" Then
oXMLHttp.Open "PUT", sHREF, False, sUserName, sPassword
Else
oXMLHttp.Open "PUT", sHREF, False ', sUserName, sPassword
End If
oXMLHttp.setRequestHeader "translate", "f" ' Set this to prevent stream problems
oXMLHttp.Send objStream.Read ' Send the stream across
nodeRef = oXMLHttp.responsetext
oXMLHttp.Open "GET", sHREF & "?noderef=" & nodeRef & "&name="& newname & ".txt" & "&description=factura&cont=" & escape(vatid) & "&value=" & escape(total) & "&date=" & escape(date) & "&number=" & escape(invoicenumber) & "&company=" & escape(company), false
oXMLHttp.Send
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.