lundi 1 juillet 2019

How to save on disk file generated with spatie/browsershot

In my laravel 5.8/blade/jQuery v3.3.1 app with https://github.com/spatie/browsershot plugin I managed in my kubuntu 18 to upload my file with path

 $save_to_file= '/home/username/Downloads/file.pdf';
 Browsershot::html(htmlspecialchars_decode($pdf_content))
     ->showBackground()
     ->save($save_to_file);

But to run it without error I had to run in my console :

sudo chmod -R 777 /home/username/Downloads/

otherwize I got error access permission

1) I wonder if there is a way to escape this error on client's OS, as I can not run

sudo chmod -R 777 /home/username/Downloads/

on client's site. I search OS independently decision

2) Can you advice some Javascript/Jquery script to open "SaveAs" dialog for choosing of saving location? And maybe somehow to check if app has not write access to info user?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire