How can i upload a file from my local machine to an issue

Added by Antonio Di Tullio almost 6 years ago

Hi,
Help me

How can i upload a file from my local machine to an issue in redmine??

language: ASP, VBA

When i upload a file with the code below, the application create a file with a text.

RequestURL1 = "http://link/issues/77621.xml?key=590fe11527aa9e185539050a5d0d3c72aa8c6d6d" 
Set xhr = CreateObject("MSXML2.XMLHTTP.6.0")
xhr.Open "PUT", RequestURL1, False
xhr.SetRequestHeader "Content-Type", "text/xml"
RequestBody = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>"
RequestBody = RequestBody & "&lt;issue&gt;"
RequestBody = RequestBody & "&lt;id&gt;" & "77621" & "&lt;/id&gt;"
RequestBody = RequestBody & "&lt;uploads type='array'&gt;"
RequestBody = RequestBody & "&lt;upload&gt;"
RequestBody = RequestBody & "&lt;token&gt;"& token.text &"&lt;/token&gt;"
RequestBody = RequestBody & "&lt;filename&gt;teste.txt&lt;/filename&gt;"
RequestBody = RequestBody & "&lt;description&gt;Teste Anexo&lt;/description&gt;"
RequestBody = RequestBody & "&lt;content_type&gt;application/txt&lt;/content_type&gt;"
RequestBody = RequestBody & "&lt;/upload&gt;"
RequestBody = RequestBody & "&lt;/uploads&gt;"
RequestBody = RequestBody & "&lt;/issue&gt;"