Home > other >  How to upload text file (.txt) in cloudinary using nodejs?
How to upload text file (.txt) in cloudinary using nodejs?

Time:12-22

I have a text file with extension ".txt" that needs to be uploaded on Cloudinary. Cloudinary is not allowing me to do that.

Any help on this will be appreciated.

CodePudding user response:

What do you mean upload ".txt"? I googled it and first few seconds into the research I found this: [![enter image description here][1]][1] [![enter image description here][2]][2]

It's a image/video hosting service not a cloud storage service. But there are tons of such services that allow uploading [1]: https://i.stack.imgur.com/b09yV.png [2]: https://i.stack.imgur.com/aGbyO.png

CodePudding user response:

You didn't specify what error you're receiving, but Cloudinary does support non-image, non-video uploads, which are called 'raw' files: https://cloudinary.com/documentation/upload_images#uploading_non_media_files_as_raw_files

A possible error you may encounter is if you haven't set the resource_type to raw in your API call, or if you've set resource_type to auto but the filename of the uploaded file wasn't sent on the upload API call. In that case, it's likely that Cloudinary was expecting an image file, and didn't detect that you sent a .txt file.

If so, you'll receive an 'invalid image file' error if the file was treated as an image - specifying the resource type explicitly should resolve that

  • Related