Jump to content

folder and sub-folder creation error


jure_matjaz

Recommended Posts

Hello!

I have problem with sub folder creation. I have tried with mkdir and even with shell_exec. Can you help. Here is the code....

---first code----

<?php

mkdir("album", 0777);
chmod("album", 0777);
//i've added this because it didn't want to set permisions to 777
mkdir("album/1/", 0777);

if (file_exists("album/")) {
  echo "Mapa obstaja";
} else {
  echo "Mapa ne obstaja";
}
if (file_exists("album/1/")) {
  echo "<br>Podmapa obstaja";
} else {
  echo "<br>Podmapa ne obstaja";
}
?>

----end------

----second_code------
<?php

shell_exec('mkdir album');
chmod("album", 0777);
shell_exec('cd album/ ; mkdir 1');


if (file_exists("album/")) {
  echo "Mapa obstaja";
} else {
  echo "Mapa ne obstaja";
}
if (file_exists("album/1/")) {
  echo "<br>Podmapa obstaja";
} else {
  echo "<br>Podmapa ne obstaja";
}
?>


---end----


Thank you for your help! Jure
Link to comment
Share on other sites

Hello!

At first i want to thank you, for your interest in problem...

I've tried useing umask, but folder has permisions(777) even without umask, so i think this isn't a problem.
I contacted my server administrator, to disable open_basedir function. But i didn't get reply ... so i don't know jet, if there is a problem.

Thank you for your help! Jure
Link to comment
Share on other sites

Hello again.

Now i've tried to use script with disabled open_basedir function, and it didn't work.

I don't get it... i have one function on other page for uploading pictures and i use ...

. ...shell_exec('cd slike/ ; mkdir ' . $album . ' ');... function

and it's working fine.

If i wan't to create folder with shell_exec here, it doesn't work....

If you have any other ideas, please let me know.

Thank you for your help! Jure
Link to comment
Share on other sites

Hello! Please if anybody can try this on his server, so i figure it out, if there is problem in code or server...


--------folders.php----------


<?php

mkdir("folder1", 0777);
chmod("folder1", 0777);
//i've added this because it didn't want to set permisions to 777
mkdir("folder1/folder2/", 0777);

if (file_exists("folder1/")) {
  echo "Folder exists";
} else {
  echo "Folder doesn't exist";
}
if (file_exists("folder1/folder2/")) {
  echo "
Sub-folder exists";
} else {
  echo "
Sub-folder doesn't exist";
}
?>

----------end------------------

[b]It should make folder1 and sub-folder folder2 in folder1[/b]

Thank you for your help! Jure
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.