create a folder in local computer from online system in php
<p>I want to save a file from the online system and save it into specific,ex. C:/myFolder/. So,if in the C:/ there is no myFolder name,the system will automatically detect and create the folder in C drive, and save the file into that folder. When I try system locally, it can create the folder and the file into C drive.</p>

<p>But when it upload my file into the server, the folder was created within the server, not in the local computer. Can anyone help me how to solve this? how to create a folder in local computer and save file into that folder from online system?</p>

<p>Below is the code that works when the system runs locally:</p>

<pre><code>$directory = 'C:/sales/'.$filename.'.txt';

$path_name = 'C:/sales/';

if ( ! is_dir($path_name)) {
    mkdir($path_name);
}

if(mysql_num_rows($query))
{
    $fp = fopen($directory, 'w');

    if($fp)
    {
        for($i = 0; $i &lt; mysql_num_rows($query); $i++)
        {
            $f = mysql_fetch_array($query);

            $orderFee_q = mysql_query("select * from sales_order where status in ('waiting', 'waiting1', 'waiting2', 'approved') and outstanding = 'N' order by so_no desc");
            $get_orderFee = mysql_fetch_array($orderFee_q);

            $line = $f["id"]."\t".$f["so_no"];

            if(trim($line) != '') {fputs($fp, $line."\r\n");}
        }
    }

    fclose($fp);
}


$download_name = basename($filename);

if(file_exists($filename))
{
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Transfer-Encoding: Binary');
header("Content-Disposition: attachment; filename=".$download_name);
header('X-SendFile: '.$filename);
header('Pragma: no-cache');
header("Expires: 0");
readfile($filename);
}   
</code></pre>
