If I try to to submit form data using "Content-Type: multipart/form-data", the request is rejected with the message "406 Not Acceptable: Unsupported request content type multipart/form-data". Multipart forms should be supported because they are the best way to upload images.

Comments

marcingy’s picture

Status: Active » Closed (won't fix)

This is a duplicate of #1066154: Add support for multipart/form file upload which I believe needs some d6 testers.

marcingy’s picture

Status: Closed (won't fix) » Closed (duplicate)

meh

voxpelli’s picture

Status: Closed (duplicate) » Active

The solution in #1066154: Add support for multipart/form file upload was never supposed to work with PUT requests - only with POST requests since PHP doesn't recognize PUT requests and therefor doesn't know how to handle them. That's one of the reasons why I thought we should either code our own support for multipart or not support it at all.

Marking this as active since #1066154: Add support for multipart/form file upload won't solve it.

Regarding multipart being the best way to upload images - I disagree. A PUT or POST containing the raw file alone would in my opinion be better since it's easier and as far as I know there's also support for building such resources in Services already.

jnross’s picture

voxpelli,

You're right that uploading a raw file alone is a great solution - this is the strategy I'm currently working on. My statement in the original report would be better put as: Multipart forms are a better way to send a raw file and metadata than a JSON or XML request with base64_encode, because it avoids the encoding overhead and inflation.

kylebrowning’s picture

Its been fixed in 7.x by adding it to the parsers for the rest server, however this wasn't done in 6.x

'multipart/form-data' => 'RESTServer::parseFile',

This has been fixed in 6.x

kylebrowning’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

lasconic’s picture

As a reference, here is the related PHP bug : https://bugs.php.net/bug.php?id=55815
"PUT request data should be parsed just like POST"

jwilson3’s picture

Version: 6.x-3.0-rc3 » 5.0.0-beta8
Issue summary: View changes

multipart/form-data in PUT requests will finally be parsed and handled properly in PHP 8.4

https://wiki.php.net/rfc/rfc1867-non-post