Jan Genvher Papica
Jan Genvher Papica

Reputation: 151

Permission denied when saving a file to xampp htdocs directory

Hello I have this problem that I am trying to save a file to a directory on htdocs it says permission denied.

  <?php


$image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
file_put_contents('./images/myFile.gif', $image);

enter image description here

Upvotes: 3

Views: 6570

Answers (2)

Ali Osman
Ali Osman

Reputation: 1

You can grant write Permissions to others and group targeting the htdocs directory using the following command:

sudo chmod -R 777 /opt/lampp/htdocs

Upvotes: 0

Arebhy Sridaran
Arebhy Sridaran

Reputation: 586

You have to allow the permission to insert the image into the specific folder which is in htdocs for an example In ubuntu

sudo chmod 644 /opt/lampp/hdocs/yourfolder

like wise you have to give permission to access that specific folder

Upvotes: 3

Related Questions