View Full Version : Directory in directory
bluewalrus
01-03-2010, 06:08 AM
mkdir($path . $gal_name);
mkdir($path . $gal_name . "/thumb");
Should this work or am I missing something? I want to create 2 directories at a time. Without the second line it was working, but when I put the second line in it created a directory that I couldnt access with my ftp or rmdir.
djr33
01-03-2010, 07:32 AM
Looks fine to me, assuming $path and $gal_name make sense-- is there a slash being added between those, or are they becoming one string-- $pathgal_name, not $path/$gal_name?
It may be an issue with folder permissions. You can use the second parameter to create it with 0777 (all access).
Then the third parameter can be used to make it recursive, and save you a bit of work.
http://php.net/manual/en/function.mkdir.php
bluewalrus
01-03-2010, 02:58 PM
I think the variables are correct...
$path = "./images/$user/";
$gal_name = "users text input";
$user = "text string depending on user";
What are the default settings if 0777 isn't set? Does that only grant the php user access?
simplecode
01-03-2010, 07:12 PM
Just try
mkdir($path . $gal_name . "/thumb",0777, true);
But for security reason use this
$gal_name = preg_replace("/[\/\.\s]/","",$gal_name);
this will remove slashes, dots and whitespaces
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.