Reputation: 23
I am having a problem with how to download the file into our desired folder, this below is my code for download.php
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($fileName));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header ("Cache-Control: must-revalidate");
header('Pragma: public');
ob_clean();
flush();
readfile($data);
echo $data;
exit;
I want to download the file to my desired folder like C:\Users\Asus or D:\Program not to the default one $data is the content of the file and $filename already include the extension Ex:picture.jpg
Thx before for all the help that i can get :)
Henry
Upvotes: 0
Views: 1249
Reputation: 943097
There is no way to tell the client where on the client's disk to save a file to.
Upvotes: 1
Reputation: 7315
The download directory is usually handled by the browser, not by the server or PHP it's self :)
Upvotes: 0