#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    File permission errors Apache2


    My FTP account (and major user account) is piagency. All my files and folders in my /var/www/ is set to piagency as owner and of the www-data group

    the user account piagency is part of the www-data group

    my php script first creates a directory (if it doesnt exist) then uploads the file to that folder.....or is supposed to.


    [PHPNET=""]mkdir("/uploads/" . $_REQUEST['clientID'] . '/video/', 0777);

    move_uploaded_file($_FILES['vidfile']['tmp_name'], $filename)[/PHPNET]
    I get mkdir(): No such file or directory

    and

    failed to open stream: No such file or directory

    Weird thing is that i cant delete the video folder and try again. Filezilla says folder is not empty

    But it will create the folder

    and it will upload the smaller file (there are actually 2 files that get uploaded to same folder)

    but the folder says its owner is www-data and group www-data.

    But from FTP i cant delete it.

    Any ideas?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    Philadelphia, PA, USA
    Posts
    4
    Rep Power
    0
    It should be "./uploads/" ... When you say "/uploads/" this indicates the uploads folder is in the root directory, but in reality it is in your user directory.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0
    Originally Posted by razordave
    It should be "./uploads/" ... When you say "/uploads/" this indicates the uploads folder is in the root directory, but in reality it is in your user directory.
    No its in the root directory. The website displays links to these files for download.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    Philadelphia, PA, USA
    Posts
    4
    Rep Power
    0
    I think we might have different definitions of root directory. On the web server, the root directory may be /uploads/. However On the filesystem of the server, The directory is probably something like /home/username/public_html/uploads/. My guess is that It is trying to write to /uploads/ on the main filesystem and that does not exist. Could you please verify?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0
    /uploads is in the root directory of my website not the home users root. I can't use ./ because this file calling this script is not in the same directory. But the problem is not with it creating the directory. If i delete the directory this script creates it.

IMN logo majestic logo threadwatch logo seochat tools logo