Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
File::create_dir() getting Invalid basepath: cannot create directory at this location
  • Hello sir,

    I am getting error.

    The folder permission is 777 and so it should create folder.

    Source code is following.

    \File::create_dir(APPPATH.'tmp/',$id,0777); 

    So, I am using mkdir() function to create folder for now.

    Is this a bug?
  • You get that if APPPATH.'tmp/' does not exist or is not accessable.

    I assume you haven't configured any base area in your file.php config file? Is this on Windows? Does that trailing slash need to be there (I don't think so)?
  • Dear sir,

    Thank you for your reply.

    APPPATH.'tmp/' dose exists and folder permission is set to 777.

    So, I guess it should work.

    Also, my environment is on ubuntu, not windows.

    Today, I just try to use "mkdir()" in PHP and it is working.


  • I don't think that trailing slash should be there.
  • Hello there,

    The path is set to following and not wokring

    /var/vhost/www/fuel/app/tmp/sales/customer/

    My current environment is following.

    Ubuntu 16.04.2 LTS.
    PHP 7.0.18
    Apache/2.4.18

    Possibly, it is related to PHP version?
  • I can't reproduce it:

    [wanwizard@catwoman] $ oil console
    Fuel 1.9-dev - PHP 7.0.20 (cli) (Jun  7 2017 04:59:03) [Linux]
    >>> $id = "testdir";
    >>> \File::create_dir(APPPATH.'tmp/',$id,0777); 
    true
    >>> ^C

    /data/www//fuelhosts/19develop 
    [wanwizard@catwoman] $ ls -l fuel/app/tmp
    total 12
    -rw-rw-r-- 1 wanwizard g_www       33 Mar  8  2014 csv.txt
    drwxrwxrwx 2 wanwizard wanwizard 4096 Jun 30 13:30 testdir

  • Perhaps it is related to your Fuel version, and you've bumped into an issue that has since been fixed?
  • Hello sir,

    Using oil console, I can create folder without any error.

    Well....this is just weird for me.

    The error message says as following.

    Error - Filename given is not a valid file. in /var/host/www/fuel/core/classes/file.php on line 847

    I will take a look at that

    P.S
    My current version of fuelPHP is 1.8.

  • If the console works, but the code doesn't, chances are you have a rigths issue, where you, as commandline user, are allowed to create it, but the webserver hasn't.

    You can see that in my console example above: the file is created with my personal user and group, and not with the (in my case) g_www group, which gives the webserver access to the file. 
  • As I stated the permission of the folder is set to 777, everyone should be able to create folder.

    I also tested the php builtin library mkdir() and it is working okay for me, which means the permission is okay.

    So, possibly the way of using your \File is wrong or there is something wrong with my program.

    I am still looking for why this is happening, but, I can not find.

    I will let you know when I found what is wrong with it.

    regards,

Howdy, Stranger!

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

In this Discussion