Hello, there is a code:

$id= rand(); mkdir ("share/$id"); chmod ("share/$id", 777); move_uploaded_file($_FILES["file"]["tmp_name"], "share/$id/".$name); 

This code gives an error:

Warning: move_uploaded_file (share / 34602835 / search4.jpg): On line 24: Warning: move_uploaded_file (): Unable to move '/ tmp / phpKC0e0Y' to 'share / 34602835 / search4. jpg 'in ... on line 24

24 line is: move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "share / $ id /".$ name);

What is this mistake about?

On the server nginx, as the front end to the Apache. All scripts work except this.

    1 answer 1

    Understood.

     chmod ("share/$id", 777); 

    Instead:

     chmod ("share/$id", 0777);