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.

Add support for PUTting files

See original GitHub issue

I wanted to PUT files on my server using express and multer but after some hours I resigned - it’s not possible, is it? (see http://stackoverflow.com/questions/33976006/multer-wont-recognize-files-with-put)

app.put('/upload/:file', upload.any(), function (req, res, next) {
  console.log('files: ' + req.files);
  console.log(req.params.file);
  res.send('got that');
})

IMO this should work. It should accept whatever file I PUT. It shouldn’t be much work to add support for this, I think. I’ll take a look at the sources; maybe I can file a PR.


P.S.: How can I accept any path that comes with PUT? Something like app.put('^/.*$', ...) or app.put('^/.+$', ...).

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
LinusUcommented, Dec 6, 2015

Multer does support PUT, as noted in the answer on stack overflow, the problem is that your curl call is sending the raw file, not a multipart/form-data. The following call should work for you.

curl -X PUT --form "file=@someFile.jpg" http://localhost:8888/up

If you want to accept raw boides instead, which is another use case and thus isn’t covered by multer, you could use body-parser. Have a look at the raw function.

0reactions
LinusUcommented, Dec 6, 2015

No problem, discussion is always good 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upload and share files - Microsoft Support
Try it! Upload and share files to work with others in Microsoft Teams. Attach a file from a channel. In a channel, under...
Read more >
Add files and folders to shared drives - Google Support
On the left, click a shared drive or existing folder. Click New "" and then Folder. Enter a folder name and click Create....
Read more >
Organize files in folders on Mac - Apple Support
In the Finder on your Mac, organize files in folders. As you create documents, install apps, and do other work, add new folders...
Read more >
Adding support resources to your project - GitHub Docs
To direct people to specific support resources, you can add a SUPPORT file to your repository's root, docs , or .github folder.
Read more >
Upload to Box With the File Browser - Box Support
In the All Files section, click New + button in the upper-right corner. · Select File Upload or Folder Upload, depending on what...
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