Help solve this php write folder error

Discussion in 'Programming' started by tech4, Mar 28, 2010.

  1. #1
    Hi Digitalpoint: I have this error I don't know why. Maybe someone with xp will know.

    Warning: mkdir() [function.mkdir]: Permission denied in /usr/home/allfoodm/domains....file.php in line 18

    What does a warning mean?
    Why is permission to write denied?

    Does it have to do with that file.php in line 18?

    This is what line 18 is
    How can I fix it?

    $dir = realpath("../uploadedfiles");

    if (is_dir($dir)) {



    srand(make_seed());

    $id = md5(time().rand());

    $dir .= DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR;
    // $dir .= DIRECTORY_SEPARATOR.$id;

    Line 18 here>>>>if (!is_dir($dir) && mkdir($dir)) chmod($dir,0777);



    if (is_dir($dir)) {

    $filename = $dir.basename($filename);

    if ($filename && ((file_exists($filename) && unlink($filename)) || !file_exists($filename))) {

    move_uploaded_file($_FILES['filename'.$i]['tmp_name'],($filename)) ;

    $uploaded = true;
     
    tech4, Mar 28, 2010 IP
  2. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    you need chmod "../uploadedfiles" to 0777
     
    guardian999, Mar 28, 2010 IP
  3. tech4

    tech4 Well-Known Member

    Messages:
    544
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    125
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    What do you mean I need chmod "../uploadedfiles" to 0777 ?

    I have a folder called "uploadedfiles"

    CAn you explain? (not a programmer) so tell me in simple language I can understand.
     
    tech4, Mar 28, 2010 IP
  4. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Go to File Manager, change permission of "uploadedfiles" to write able (0777).
     
    guardian999, Mar 28, 2010 IP
  5. phprightnow

    phprightnow Peon

    Messages:
    296
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    Or you can do via SSH:

    chmod 0777 uploadedfiles

    Most FTP managers allow you to CHMOD your values aswell.
     
    phprightnow, Mar 28, 2010 IP
  6. tech4

    tech4 Well-Known Member

    Messages:
    544
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    125
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    I see, how would I do that with "DirectAdmin" there's 2 options not sure if there are more. 1)set permissino 755, the other 2)reset own.
    I think I could change the set permission to be "777" without the 0 would that work? (Question 1)


    ---------------
    I am using FTP commander,
    Is it 0777 and 777 the same thing in php ? chmod ?
    How would I do that in FTP commander ? (Question 2)
     
    tech4, Mar 28, 2010 IP
  7. tech4

    tech4 Well-Known Member

    Messages:
    544
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    125
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Problem Solved!

    Thank you both!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    tech4, Mar 28, 2010 IP
  8. Basti

    Basti Active Member

    Messages:
    625
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    90
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    use 777, in most ftp managers you simply need to right click on the folder and click Chomod Properties / or File Properties / or just Properties. Then a dialog should popup where you can write in numbers, along with some checkboxes ( at least in mine ) which check/uncheck if you write your persmissions, so you will see exactly what the number are good for

    Edit: ah to late :)
     
    Basti, Mar 28, 2010 IP
  9. tech4

    tech4 Well-Known Member

    Messages:
    544
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    125
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    Thanks Basti,

    even though you're late.

    BTW. If I was downloading from outlook, mail.mysite.com what is the outgoing box ? I used mail.mysite.com and it does not work.

    Do you know the general in and out box ?
    I know the in box is default mail.mysite.com but not the out? what is it? is it outmail.mysite.com ?

    Thanks.

    ie. mail.digitalpoint.com for retrieving, whats? the outgoing address? should be in general ?
     
    tech4, Mar 28, 2010 IP
  10. Basti

    Basti Active Member

    Messages:
    625
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    90
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    Sorry, do not know. Never used outlook or webserver mail once at all.
     
    Basti, Mar 28, 2010 IP