Jump to content

HELP CREATING DIRECTORY!


daxguy

Recommended Posts

I am trying to create random no. of directories but its always giving this error

 

Warning: mkdir() [function.mkdir]: Invalid argument in C:\xampp\htdocs\gl\movie_process.php on line 173

 

the code is

for(i=0; i<5; i++)
{
mkdir("".$base."uploads/movies/$year/$month/$title/".$hosting[$i]."");
}

Link to comment
https://forums.phpfreaks.com/topic/210583-help-creating-directory/
Share on other sites

You're passing mkdir an invalid path. To see what the path is change your code to

 

$base_folder = "{$base}uploads/movies/{$year}/{$month}/{$title}/"
for$(i = 0; $i < 5; $i++)
{
    if(is_dir($base_folder)
    {
         $path = "$base_folder/{$hosting[$i]}";
          mkdir($path);
    }
    else
    {
        echo "{$base_folder} is not a directory";
    }
}

I tried both the solutions..

even tried

 

$base_folder = "{$base}uploads/movies/{$year}/{$month}/{$title}/"
for$(i = 0; $i < 5; $i++)
{
    if(is_dir($base_folder)
    {
         $path = "$base_folder/{$hosting[$i]}";
          mkdir($path);
    }
    else
    {
        echo "{$base_folder} is not a directory";
    }
}

 

its giving the same error.. dunno wats up with this!! please help

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.