0

I'm trying to upload images to cloudinary using ng2-file-upload. I've put the endpoint in the URL and I can see the upload, but I get a 401 UnAuthorized back. Are there any examples which use the new cloudinary-ng package. I looked a the old example, which works uses a config and passes the parameters in the URL that way, but that doesn't work anymore.

This is what I got so far, which is pretty basic. Now I need to pass the cloudinary parameters in the URL. which attributes do I use?

const maxFileSize = 100 * 1024 * 1024; // (100MB);

this.uploader = new FileUploader({
        url: `https://api.cloudinary.com/v1_1/$movieprepper/upload`,
        isHTML5: true,
        removeAfterUpload: false,
        autoUpload: false,
        maxFileSize: maxFileSize,
        additionalParameter : {
          MediaType: 'Image',
        },
      });
Phil
  • 561
  • 2
  • 16
  • 29

1 Answers1

0

401 means permission issue, can you please verify that you're passing in your credentials correctly? I think that what's causing the error is the $ sign before your cloud name in the URL. It should be: url: `https://api.cloudinary.com/v1/movieprepper/upload

Btw, Cloudinary uses a 3rd party system ng2-file-upload to perform the uploads. You can take a look at the sample project on an example implementation for image uploads- https://github.com/cloudinary/cloudinary_angular/blob/65e659f838eb03dd01bfbda1af5a10a2889ef9c7/samples/photo_album/app/js/photo-album/photo-upload.component.ts

Cake
  • 104
  • 2