How to save downloaded csv file to specified directory using php -


i using php script download data database , export csv format.i can generate file problem facing gets downloaded downloads folder of computer.

i want download file specific folder.how it?

here code

    $result=sqlsrv_query($conn,$stmt);     $out='';    $filedate=date("y-m-d");  $output='$filedate.nrml_cash_position_trade.csv';   while ($l = sqlsrv_fetch_array($result, sqlsrv_fetch_assoc)) {    foreach($l $key => $value){     //if character " exists, escape it, otherwise csv file    invalid.      $pos = strpos($value, '"');      if ($pos !== false) {         $value = str_replace('"', '\"', $value);     }     $out .= '"'.$value.'",';   } $out .= "\n";  }     header("content-disposition: attachment; filename= $output");  echo $out;` 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -