phpmysqlhtdocs

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


Solution

  • 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