Closed Mirieri closed 6 months ago
Is your trace pointing to a VichUploaderBundle location? If so, please provide all the relevant information
Yes it is
vich_uploader:
db_driver: orm
mappings:
imageFile:
uri_prefix: /images/mob_image
upload_destination: '%kernel.project_dir%/public/images/mob_image'
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
Your original comment (before the editing) was more relevant and didn't show any mention of this bundle. What makes you think the problem is here?
here is the trace:
{"type":"https:\/\/tools.ietf.org\/html\/rfc2616#section-10","title":"An error occurred","detail":"The content-type \u0022multipart\/form-data; boundary=--------------------------975666414905954377383152\u0022 is not supported. Supported MIME types are \u0022application\/json\u0022.","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/api-platform\/core\/src\/Symfony\/EventListener\/DeserializeListener.php","line":166,"args":[]},{"namespace":"ApiPlatform\\Symfony\\EventListener","short_class":"DeserializeListener","class":"ApiPlatform\\Symfony\\EventListener\\DeserializeListener","type":"-\u003E","function":"getFormat","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/api-platform\/core\/src\/Symfony\/EventListener\/DeserializeListener.php","line":129,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["array",{"json":["array",[["string","application\/json"]]]}]]},{"namespace":"ApiPlatform\\Symfony\\EventListener","short_class":"DeserializeListener","class":"ApiPlatform\\Symfony\\EventListener\\DeserializeListener","type":"-\u003E","function":"onKernelRequest","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/event-dispatcher\/Debug\/WrappedListener.php","line":117,"args":[["object","Symfony\\Component\\HttpKernel\\Event\\RequestEvent"],["string","kernel.request"],["object","Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"]]},{"namespace":"Symfony\\Component\\EventDispatcher\\Debug","short_class":"WrappedListener","class":"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener","type":"-\u003E","function":"__invoke","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":230,"args":[["object","Symfony\\Component\\HttpKernel\\Event\\RequestEvent"],["string","kernel.request"],["object","Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"]]},{"namespace":"Symfony\\Component\\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"-\u003E","function":"callListeners","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":59,"args":[["array",[["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"],["object","Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"]]],["string","kernel.request"],["object","Symfony\\Component\\HttpKernel\\Event\\RequestEvent"]]},{"namespace":"Symfony\\Component\\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"-\u003E","function":"dispatch","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/event-dispatcher\/Debug\/TraceableEventDispatcher.php","line":151,"args":[["object","Symfony\\Component\\HttpKernel\\Event\\RequestEvent"],["string","kernel.request"]]},{"namespace":"Symfony\\Component\\EventDispatcher\\Debug","short_class":"TraceableEventDispatcher","class":"Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher","type":"-\u003E","function":"dispatch","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":133,"args":[["object","Symfony\\Component\\HttpKernel\\Event\\RequestEvent"],["string","kernel.request"]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E","function":"handleRaw","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":79,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"-\u003E","function":"handle","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/vendor\/symfony\/http-kernel\/Kernel.php","line":195,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1],["boolean",true]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"Kernel","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"-\u003E","function":"handle","file":"\/Users\/mirierimogaka\/Downloads\/rest_api\/adgg-zoetis-api\/public\/index.php","line":20,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"]]}]}
Your original comment (before the editing) was more relevant and didn't show any mention of this bundle. What makes you think the problem is here?
Is it possible to set content-type format with this bundle?
Which content type?
Try to watch these videos. he has the same issues as you have and he fixed it.
https://www.youtube.com/watch?v=DE244fDABxE&t=589s https://www.youtube.com/watch?v=E8hdiWtLKLU&t=1054s
I am currently facing an issue with the VichUploader bundle in my Symfony project, specifically when attempting to upload an image using the multipart/form-data content type.
Here are the details of the error I encountered:
It seems that the content type "image/jpeg" is not recognized or supported, and the application is expecting one of the following MIME types: "application/ld+json", "application/json", "text/html".
I have verified my VichUploader configuration, and it appears to be correctly set up. Here is a snippet of my configuration:
My Entity model is
under config /config/api_platform/