+ Reply to Thread
Results 1 to 7 of 7

VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Hi all,

    I am posting a WinHTTP POST request to an internal company site, and get an error HTTP responsetext saying "Required MultipartFile parameter 'file' is not present". I don't understand why.
    Code so far (internal site obfuscated):

    Please Login or Register  to view this content.
    The structure of the request and body was taken directly from the actual request, so there is nothing weird on that.
    I added the following bit in order to try and fix the issue, but it doesn't help (it doesn't seem to hurt either).

    Please Login or Register  to view this content.
    I've also replaced Chr(10) with Chr(13) -- essentially trying both VbNewLine and VbCrLF, but it doesn't matter either.

    Please help!

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Best bet is to use Developer Tool on browser of your choice and trace what request parameters are sent with POST request.
    Make sure to check un-parsed raw string that's sent.

    This will give you exact query parameter string you need to send.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Did just that and it looks identical (the body) - I also tried to add all the requestheaders as below - didn't help.
    In my experience, missing requestheaders would also give a different error.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Hmm, try replacing CHR(10) with '%0D%0A' which is URL encoded vbNewLine/vbCrLf.

    Also, see link for more details on multipart/form-data
    https://www.w3.org/TR/html401/intera...html#h-17.13.4

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Tried to no avail - also read your link (thanks!), but don't see anything wrong.
    Let me try and get the raw string from another browser...

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    I figured it out -- the bit with the data (for x part) needed Chr(10), the rest needed Chr(13) + Chr(10).
    You can't make this sh.t up...

    Thanks for the help CK76 - much appreciated!

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA WINHTTP POST - Required MultipartFile parameter 'file' is not present

    Dang, that's an odd set up. Glad you got it solved though

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] WinHTTP POST request: Forgery protection token was not present.
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2016, 10:52 AM
  2. WinHTTP Post command not updating site
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2015, 11:34 PM
  3. WINHTTP / JSON post body to include search array from excel
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-12-2015, 09:48 AM
  4. [SOLVED] xml or winhttp - Can I send a POST request with a lot of parameters?
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-02-2015, 04:52 AM
  5. [SOLVED] Formula required to return YES/NO if a specified word is present in a cell
    By @MeDaveT in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-17-2014, 04:33 AM
  6. [SOLVED] WinHttp data collection with login required
    By Zaf01 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-02-2012, 08:07 AM
  7. [SOLVED] Error 424 Object Required when passing range as parameter
    By carrick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-29-2006, 06:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1