Post Project
  • Search
    • Buyers can
    • Search offers to buy now
    • Search freelancers to request a proposal
    • Freelancers can
    • Search projects to quote on
  • How it works
  • Log in
  • Sign up
  • Freelancer?
Browse by Category
    Technology & ProgrammingWriting & TranslationDesignDigital MarketingVideo, Photo & ImageBusinessMusic & AudioMarketing, Branding & SalesSocial Media

    Debug conversion of HTML code to VBA code

    - or -

    Post a project like this
    1819
    $15
    • Posted: 5 years ago
    • Proposals: 3
    • Remote
    • #1555517
    • PRE-FUNDED
    • Completed
    Simon C.Anita G.Ronak P. have already sent a proposal.
    • 1
    • 1

    Description

    Experience Level: Intermediate
    General information for the business: Software developer
    Kind of development: Customization of existing program
    Description of requirements/functionality: I am out of my depth on a particular piece of code and am looking for a solution to an error that I am getting. The code should post a multipart request consisting of filename, mime type and the file stream to an api end point.

    This is a cut down version of the code as it currently stands

    Const STR_BOUNDARY As String = "3fbd04f5-b1ed-4060-99b9-fca7ff59c113"
    Dim xmlHtp As MSXML2.XMLHTTP60, Access_Token As String, eurl As String
    Dim baBuffer() As Byte, FileNum As Integer, PostData As String

    FileNum = FreeFile()
    Open "C:\Users\DrHardy\VStocking\Test2.pdf" For Binary Access Read As #FileNum
    ReDim baBuffer(0 To LOF(FileNum) - 1) As Byte
    Get FileNum, , baBuffer
    PostData = StrConv(baBuffer, vbUnicode)
    Close #FileNum

    Posting = "--" & STR_BOUNDARY & vbCrLf & _
    "Content-Disposition: form-data; name=""Test2""; filename=""C:\Users\DrHardy\VStocking\Test2.pdf""" & vbCrLf & _
    "Content-Type: application/pdf" & vbCrLf & vbCrLf & PostData & vbCrLf & "--" & STR_BOUNDARY & "--"

    Set xmlHtp = New MSXML2.XMLHTTP60
    With xmlHtp
    .Open "post", eurl, False
    .setRequestHeader "Access-Token", Access_Token ' Token is only valid for 60 minutes
    .setRequestHeader "Content-Type", "multipart/form-data ; boundary=" & STR_BOUNDARY
    .send Posting
    Debug.Print .ResponseText
    End With

    The output from the debug is {"code":"NO_FILE_CONTENT","message":"Must provide file body"}

    I have based my solution on this post https://wqweto.wordpress.com/2011/07/12/vb6-using-wininet-to-post-binary-file/

    If you Google the contents of the STR_BOUNDARY variable you will find many other similar solutions.

    The documentation for the api has this code for using HTTP

    POST /api/rest/v5/transientDocuments HTTP/1.1
    Host: api.na1.echosign.com
    Access-Token: MvyABjNotARealTokenHkYyi
    Content-Type: multipart/form-data
    Content-Disposition: form-data; name="File"; filename="MyPDF.pdf"



    I believe that the problem lies with the implementation of

    I have tried many alternatives to the solution shown above, if all the STR_BOUNDRY entries are removed the error is {"code":"INVALID_MULTIPART","message":"An invalid multipart was specified"}

    I just need the solution to the error code.
    Specific technologies required: HTML, VBA
    OS requirements: Windows
    Extra notes:
    Dr David H.
    Dr David H.
    100% (2)
    Projects Completed
    2
    Freelancers worked with
    2
    Projects awarded
    100%
    Last project
    24 Dec 2017
    United Kingdom

    New Proposal

    Login to your account and send a proposal now to get this project.

    Log in

    Clarification Board Ask a Question

    • 02 May 2017Mark R.

      What are you passing as the value for eurl?

    • 02 May 2017Amit G.

      can you please increase price?

      Dr David H.02 May 2017

      I am willing to pay $30 per hour but would need an idea of how long it would take. If you are familiar with both HTTP and MSXML2.XMLHTTP60 it should be a quick job.

    405996405839
    1819
    $15

    - or -

    Post a project like this
    Dr David H.
    Dr David H.
    100% (2)
    Projects Completed
    2
    Freelancers worked with
    2
    Projects awarded
    100%
    Last project
    24 Dec 2017
    United Kingdom

    Related project Searches


    html/html5 application programming interface (API) customization debugging documentation microsoft windows operating system (os) software development VBA programming language web

    Product

    • About
    • Team
    • Careers

    Support

    • How it works
    • Trust & Safety
    • Help Centre

    Discover

    • GuidesStoriesNews

    Resources

    • Customer Stories
    • Business Cost Calculator
    • Startup Cities

    Browse

    • Freelance Services
    • Freelance Services By Country
    • Freelance Skills
    • Terms
    • Privacy
    • Sitemap
    • © 2022 People Per Hour Ltd
    We use cookies to improve your experience and our services. By using PeoplePerHour, you agree to ourCookie Policy