Start a new topic

publicly readable doesnt work

I try to upload a pic, but when i log as another user i don't have the permissions.



I tried (AS IT IS WROTE DOWN THE GUIDES)



var promise = Kinvey.File.upload(

b64toBlob(imageData,"data:image/jpeg;base64,",false),

{

_id : window.localStorage.getItem("username"),

mimeType : 'image/jpeg',

size : imageData.length

},

{

public : true,

success: function(file) {

setImage();

},

error: function(response) {

alert('Server error, try again later.')

}

});



AND (as suggested HERE https://support.kinvey.com/discussion/201272194/uploading-a-public-readable-image-file) I TRIED SO:



Kinvey.File.upload(

b64toBlob(imageData,"data:image/jpeg;base64,",false),

{

_id : window.localStorage.getItem("username"),

mimeType : 'image/jpeg',

size : imageData.length

},

{public: true}

).then(function(file) {

console.log("caricata");

setImage();

});





SO I have 2 question:

1. Where do I mistake?

2. how to modify the _acl so I (hope) can solve all my problems setting all readable to everyone.

now it works thanks

You can set the `_acl` as follows:



```

Kinvey.File.upload(

b64toBlob(imageData, "data:image/jpeg;base64,", false), {

_id: window.localStorage.getItem("username"),

_acl: {

gr: true

},

mimeType: 'image/jpeg',

size: imageData.length



}, {

public: true

}



).then(function (file) {

console.log("caricata");

setImage();

});

```
Login or Signup to post a comment