Use transferobserver Android to set permissions for AWS objects
•
Android
private void beginUpload(String filePath) {
if (filePath == null) {
Toast.makeText(this, "Could not find the filepath of the selected file", Toast.LENGTH_LONG).show();
return;
}
File file = new File(filePath);
TransferObserver observer = transferUtility.upload(Constants.BUCKET_NAME, file.getName(), file);
observers.add(observer);
HashMap<String, Object> map = new HashMap<String, Object>();
Util.fillMap(map, observer, false);
transferRecordMaps.add(map);
observer.setTransferListener(new UploadListener());
simpleAdapter.notifyDataSetChanged();
}
resolvent:
Use putobjectrequest to set permissions on the current bucket and file (such as this)
if(this.publicRead)
{
por.setCannedAcl(CannedAccessControlList.PublicRead);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码