title: Upload Excel xlsm file to php script using VBA
body: <p>I would like to upload an Excel xlsm file to a php script from VBA. I found the following code: </p>
  
  <pre><code>Dim WinHttpReq As Object
  Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
  
  Dim strURL As String
  Dim StrFileName As String
  Dim FormFields As String
  Dim path As String
  Dim name As String
  
     StrFileName = "c:\temp\ctc1output.xls"
     strURL = "http://www.tri-simulation.com/P3/"
  
  
     WinHttpReq.Open "POST", strURL, False
  
  
     ' Set the header
    WinHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  
  
     FormFields = """fileulp=" &amp; StrFileName &amp; """"
     FormFields = FormFields + "&amp;"
     FormFields = FormFields + """sfpath=P3"""
  
     WinHttpReq.Send FormFields
  
  
     ' Display the status code and response headers.
     MsgBox WinHttpReq.GetAllResponseHeaders
     MsgBox WinHttpReq.ResponseText
  </code></pre>
  
  <ol>
  <li>Should I handle the file as a binary file or another type of file?</li>
  <li>Can I upload the file while it is still open (I want to upload the file from which the VBA is running from)?</li>
  </ol>
  
  <p>I am not sure if I'm on the right track. 
  I'm also not sure about what the headers and form fields should be.</p>
  
  <p>Thx for any help.</p>