12

Cloudinary only has an example for how to load images from android to the cloud. However I need to upload videos. When I use the call from the sample code I get an Invalid image file error. Here is the call that throws the exception

Map cloudinaryResult=cloudinary.uploader().upload(file, uploadParams);

Does anyone know the call for uploading videos instead of photos? I am using Cloudinary with Parse.com

Here is the stack trace

java.lang.RuntimeException: Invalid image file
            at com.cloudinary.android.UploaderStrategy.callApi(UploaderStrategy.java:101)
            at com.cloudinary.Uploader.callApi(Uploader.java:22)
            at com.cloudinary.Uploader.upload(Uploader.java:55)
Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199

1 Answers1

15

You should add

uploadParams.put("resource_type", "video")

to tell Cloudinary that you want to upload video. Or,

uploadParams.put("resource_type", "auto")

to let Cloudinary determine the file's content.

Tal Lev-Ami
  • 1,417
  • 10
  • 10
  • 3
    It would be nice if these guys included this information in their samples or documentations. This is an unnecessary barrier to entry and waste of time. Maybe I should look into their competitors :). But check and plus one to you. Thank you. – Katedral Pillon Oct 01 '15 at 17:54
  • @KatedralPillon who are their competitors?...doesnt seem to be much offerings in this space...sans DIY recipes... – sirvon Oct 24 '15 at 07:01
  • @KatedralPillon I couldn't agree more. The docs for their iOS github repo are terrible. – user3344977 Dec 29 '15 at 18:40
  • I need to upload pdf file to cloudinary i tired to use source type auto and I got Invalid resource. – Jai Rajesh Dec 19 '17 at 14:59