Jack
Jack

Reputation: 753

How to define the path of the new directory with php

Sorry in advance if it is a newbie question, but I am trying to make a file on my desktop with php.

The following script does not work. Any idea what is wrong? I have defined the path (which is my desktop) and the name of the file.

<?php

mkdir('/Users/mary/Desktop', "test", 0777, true);
?>

Upvotes: 0

Views: 85

Answers (2)

Ambal Mani
Ambal Mani

Reputation: 315

Can you try here i mentioned code. mkdir('/Users/mary/Desktop/test', 0777, true);

Upvotes: 0

I wrestled a bear once.
I wrestled a bear once.

Reputation: 23409

PHP does not have access to write to your desktop. You would need to chmod your desktop. Open a terminal and do: sudo chmod 777 $HOME/Desktop

That's for Linux/Mac, if you're on Windows it depends on the version.

Upvotes: 2

Related Questions