Strapi: File upload using Cloudinary errors when uploading file types other than image

Created on 28 Nov 2018  路  3Comments  路  Source: strapi/strapi







Informations

  • Node.js version: v10.11.0
  • npm version: 6.4.1
  • Strapi version:
  • Database: MongoDB
  • Operating system: macOS Sierra

What is the current behavior?

Using strapi-upload-cloudinary package, uploading _videos_ and other file types other than _image_ results to an error.

screen shot 2018-11-28 at 2 00 34 pm

Steps to reproduce the problem

  1. Install strapi-upload-cloudinary package.
    > npm i strapi-upload-cloudinary
  2. Go to Plugins > File Upload.
  3. Choose Cloudinary from Providers.
  4. Set your Cloud name, API Key and API Secret and Save.
  5. Go to Files Upload and upload a video file like mp4. Get one here if you don't have one: https://sample-videos.com/
  6. Try PDF files or any other format other than image.
  7. OBSERVED. Can't upload videos or any other format like PDF.

What is the expected behavior?

Should be able to upload any file format. This works out of the box with the default one.

Suggested solutions

Set resource_type to auto for Cloudinary to automatically detect file type and take care including 'video', 'pdf' and other file types.

Example code:

const upload_stream = cloudinary.uploader.upload_stream({})

to

const upload_stream = cloudinary.uploader.upload_stream({ resource_type: "auto" })
low bug

Most helpful comment

Although the file problem should have been fixed, it still happens with e.g. with files other than images and pdfs. The changes from #2390 using:
resource_type: "auto"
don't seem to work.

9DC7C382-EBFC-4124-931D-279D03A403BA-21108-000031A53BB15477

Informations

Node.js version: 10.15.3
npm version: 6.9.0
Strapi version: 3.0.0-alpha.25.2
Database: MongoDB
Operating system: macOS Mojave

I've tripple checked my strapi-provider-upload-cloudinary version: 3.0.0-alpha.15

All 3 comments

Although the file problem should have been fixed, it still happens with e.g. with files other than images and pdfs. The changes from #2390 using:
resource_type: "auto"
don't seem to work.

9DC7C382-EBFC-4124-931D-279D03A403BA-21108-000031A53BB15477

Informations

Node.js version: 10.15.3
npm version: 6.9.0
Strapi version: 3.0.0-alpha.25.2
Database: MongoDB
Operating system: macOS Mojave

I've tripple checked my strapi-provider-upload-cloudinary version: 3.0.0-alpha.15

Can you try to find what is the issue and open a PR to fix it please.
We will appreciate your contribution on this issue.

Hello,

i had the same problem in one of my projects.

Upgrading strapi-provider-upload-cloudinary in plugins/upload/package.json of my project from 3.0.0-alpha.15 to 3.0.0-alpha.26.2 fixed it for me.

https://github.com/strapi/strapi/pull/2390 was not included in 3.0.0-alpha.15.

Informations

Node.js version: v11.14.0
npm version: 6.9.0
Strapi version: 3.0.0-alpha.24.1
Database: MongoDB
Operating system: macOS Mojave
strapi-provider-upload-cloudinary: 3.0.0-alpha.26.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

profjefferson picture profjefferson  路  3Comments

dufoli picture dufoli  路  3Comments

jskorepa picture jskorepa  路  3Comments

mnlbox picture mnlbox  路  3Comments

peeomid picture peeomid  路  3Comments