question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File uploads using multipart/form-data not working

See original GitHub issue

Adding this to my js file

let multipartHeaders = [
  {
    "name": "content-type",
    "value": "multipart/form-data"
  },
  {
    "name": "example-oauth-v1",
    "value": "<oauth_access_token>"
  }
];

let snippets = {
    usecasesUploadFile: new HTTPSnippet({
      method: 'POST',
      url: "https://www.example.com/api/projects/0.1/projects/15339651/files/",
      headers: multipartHeaders,
      postData: {
        mimeType: "multipart/form-data",
        params: [
          {
            name: "filedata",
            fileName: "/project_dir/sample_file.txt",
            contentType: "text/plain"
          }
        ]
      }
    }),
}

Returns this:

TypeError: form.pipe is not a function
HTTPSnippet../node_modules/httpsnippet/src/index.js.HTTPSnippet.prepare
node_modules/httpsnippet/src/index.js:118

 115 |   })
  116 | })
  117 | 
> 118 | form.pipe(es.map(function (data, cb) {
  119 |   request.postData.text += data
  120 | }))
  121 |

Is there something wrong with my usage?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
erunioncommented, Aug 7, 2020
1reaction
Nishchit14commented, Aug 21, 2018

I’m getting the same issue, Have you solved it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

$_POST variables not working with $_FILES and multipart ...
Users upload files along with filling out a form, and the files upload to the server but the $_POST variables do not populate....
Read more >
multipart/form-data fails to upload file when using FormData
Hi,. I'm trying to use FormData to POST a file using multipart/form-data. I noticed for very small files this works no problem but...
Read more >
File uploads with multipart/form-data stopped working - Support
I figured the issue on my own: In order a form to send the data, it needs a name attribute. In my case...
Read more >
Fix uploading files using fetch and multipart/form-data
I had a problem. The files data was not actually sent to the server. The solution was this: you must NOT set the...
Read more >
Uploading File From a Web Page Using Multipart Form POST
Important! This is a legacy article about enabling upload to Java WebDAV Server from IE 9- and legacy web browsers. You do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found