puter.perms.requestWritePictures()Request write access to the user's Pictures folder. If the user has already granted this permission the user will not be prompted and the path will be returned. If the user grants permission the path will be returned. If the user does not allow access undefined will be returned.
puter.perms.requestWritePictures()
None
A Promise that resolves to:
string - The Pictures folder path if permission is grantedundefined - If permission is denied<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<button id="request-pictures">Request Pictures Write Access</button>
<script>
document.getElementById('request-pictures').addEventListener('click', async () => {
const picturesPath = await puter.perms.requestWritePictures();
if (picturesPath) {
puter.print(`Pictures path: ${picturesPath}`);
// Now you can write files to the Pictures folder
await puter.fs.write(`${picturesPath}/my-image.txt`, 'Image data here');
puter.print('File written to Pictures folder');
} else {
puter.print('Pictures write access denied');
}
});
</script>
</body>
</html>