JamieB92 / Gamer-Connect-Backend-PP5

1 stars 0 forks source link

Unable to Upload Video to Cloudinary #19

Open JamieB92 opened 12 months ago

JamieB92 commented 12 months ago

Problem

When uploading a video file to Cloudinary, I get the following error when adding a clip to a post through the API:

Request Method: POST
Request URL:  http://8000-jamieb92-gamerconnectba-uknrxeyki12.ws-eu106.gitpod.io/posts/?vscodeBrowserReqId=1700389889051
Django Version: 3.2.23
Exception Type: Error
Exception Value: Invalid image file
Exception Location: /workspace/.pip-modules/lib/python3.9/site-packages/cloudinary/uploader.py, line 527, in call_api

Model is set to handle an upload to a file using FileField. Cloudinary does accept Video uploads to it as well.

Expected outcome

JamieB92 commented 12 months ago

Bug Fix:

The issue was I hadn't setup Cloudinary to handle Videos in the model as per this documentation: https://pypi.org/project/django-cloudinary-storage/#usage-with-video-files

Steps to fix :

Outcome: I am now able to upload a Video and a Image vie the following steps in the API:

Both display the Video or Image uploaded via the API