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
Share on other sites

Do you need a trailing slash after $base?  (e.g. $base."/uploads..."etc)

 

echo ($base."uploads/movies/$year/$month/$title/".$hosting[$i]);

 

to check that the output is a valid URL.  (you do not need the empy "" before and after your URL.)

Link to comment
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";
    }
}

Link to comment
Share on other sites

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

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.