0

I am running php script in which fopen function is not working its showing error. I am using local environment.

$newf = fopen ($newfname, 'wb');

Warning: fopen(/Applications/XAMPP/xamppfiles/htdocs/xxxxxx/uploads/image.jpg): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/xxxxx/xxx.php on line 9 Can you help me out how i handle this error?

7
  • Grant the appropriate permissions and make sure that (if applicable) base directory is correctly set.
    – Seth
    Jan 31, 2018 at 14:01
  • @Seth i already gave the permission to the folder read and write permission and i am setting base directory like that $_SERVER['DOCUMENT_ROOT'] . "/material/uploads/image.jpg".. still its giving same error Feb 1, 2018 at 4:18
  • Did you give that permission to the right group/user. What are the current permissions on the folder?
    – Seth
    Feb 1, 2018 at 6:21
  • yes I gave read and write permission to the user on the folder Feb 1, 2018 at 8:35
  • Which user? Your user? The user that the XAMPP is run as or another user? As I mentioned, what's the actual permissions on that folder?
    – Seth
    Feb 1, 2018 at 8:50

0

You must log in to answer this question.

Browse other questions tagged .