Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
\File::create_dir() in localhost
  • I am running into a bug when i'm trying to create a directory, the problem is that DOCROOT at localhost contains 'C:' which is considered as a directory and then mkdir tries to create the folder inside 'C:' which throws an exception 'mkdir(): Invalid argument' at core/classes/file.php : line 216.
    if there will be any help thanks.
  • This has fixed my probel I have replaced the lines (189, 193) with the old code from 1.7

    // unify the path separators, and get the part we need to add to the basepath
    $new_dir = substr(str_replace(array('\\', '/'), DS, $new_dir), strpos($new_dir, $name));

    // recursively create the directory. we can't use mkdir permissions or recursive
    // due to the fact that mkdir is restricted by the current users umask
    $path = rtrim($basepath, DS);
  • one other thing that I couldn't find in the core FILE class is a function to check whether a directory exists or not so I had to change the function exists and add another condition like so:

    return is_file($path) ? true : is_dir($path); 

    now the function exists will return true if a file has been found or a directory and false if not.
  • HarroHarro
    Accepted Answer
    create_dir() should be addressed here: https://github.com/fuel/core/commit/104d82bfc5b165221e8df6acae0182595a597bed

    The File class deals with files, it is a bit pointless making a class method for is_dir().
  • But as in my case I had to deal with folders more than files, if there is any good idea it will be helpful, thanks. also in the first place the create_dir() function didn't work until made changes above.
  • Which Fuel version do you use? Because the fix is for 1.9/develop, it has not been released yet.
  • "fuel/core": "1.8.*" this is from my composer.
  • HarroHarro
    Accepted Answer
    Ok. In that case you'll have to wait for the next 1.8 hotfix to get this fix.
  • I will be waiting, also I have created a package for elfinder with fuelphp I will be uploading it this days on github.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion