Fatal errorUncaught exception ZF\ContentNegotiation\Exception\InvalidMultipartContentException
egyptianbman opened this issue · 1 comments
egyptianbman commented
Hello,
I'm following the guide at https://apigility.org/documentation/recipes/upload-files-to-api and upon saving my configs after setting file upload to yes and adding multipart/form-data
to the Content-Type whitelist, sending a request in postman with multipart/form-data
yields:
<b>Fatal error</b>: Uncaught exception 'ZF\ContentNegotiation\Exception\InvalidMultipartContentException' in /.../vendor/zfcampus/zf-content-negotiation/src/MultipartContentParser.php:35
Stack trace:
#0 /.../vendor/zfcampus/zf-content-negotiation/src/ContentTypeListener.php(80): ZF\ContentNegotiation\MultipartContentParser->__construct(Object(Zend\Http\Header\ContentType), Object(ZF\ContentNegotiation\Request))
#1 [internal function]: ZF\ContentNegotiation\ContentTypeListener->__invoke(Object(Zend\Mvc\MvcEvent))
#2 /.../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Object(ZF\ContentNegotiation\ContentTypeListener), Object(Zend\Mvc\MvcEvent))
#3 /.../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('route', Object(Zend\Mvc\MvcEven in
<b>/.../vendor/zfcampus/zf-content-negotiation/src/MultipartContentParser.php</b> on line
<b>35</b>
<br />
egyptianbman commented
After much much digging I found that you don't need to send a Content-Type header in postman. Doing so hinders postman from adding the boundary dynamically.