Create directory mapped PHP folder

Asked

Viewed 39 times

1

I’m trying to create a folder in a network mapping but am not succeeding

<?php 

if(isset($_POST["databse"]) && isset($_POST["nomecli"])){

    $database = 'C:/xampp/htdocs/criarbase/'.$_POST["databse"];
    $namecli = $_POST["nomecli"];
    $caminho = 'Z:/Bases/'.$namecli;
    $destino = $caminho.'/'.$namecli.'.zip';


    if(is_dir($caminho)){

        echo 'Pasta existe';
    }else{
        if(mkdir($caminho, 0755, true)){
            print_r(error_get_last());
            if (!copy($database, $destino)) {
                echo "falha ao copiar $database...\n";
            }else{
                echo('Base enviada para servidor');
            }
        }

    }

}

?>

if I change it to the local folder works smoothly at first I thought it could be permission on the server to create the folder, for being a win server that is saving, but I switched to a win 10, and the error remains as not found the directory

  • Have you tried instead of using Z: putting the ultimate path without mapping?

  • yes, it brings the same mistake

  • Already tested this creation code on your local machine?

  • 1

    yes it works, perfectly, but if you pass it to the mapping or the direct path of the folder does not work, search in some places and say that it may be allowed the apache user to make changes to the network but I did not find anything that makes this release

  • I’ve had this problem before, if apache is running as a windows service, go to the service properties and set the user who has access to write this remote directory.

  • Jhonny I did it this as service yes and this set the admin user for him, but still nothing

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.