简体   繁体   English

将CSV文件保存在用户计算机的特定文件夹中

[英]Save CSV file in user's computer specific folder

I have php script which download csv in download folder. 我有php脚本,可在下载文件夹中下载csv。

Can I force download in specific folder.? 我可以强制在特定文件夹中下载吗?

I have PHP application which will be used by only one user also in one computer only. 我有PHP应用程序,仅一台计算机上只能由一个用户使用。

If I can't then Is there any other solution .? 如果不能,还有其他解决方法吗? Like allow user to save file in specif folder etc etc..? 像允许用户将文件保存在specif文件夹等中吗?

Thank You 谢谢

while ($row = mysql_fetch_array($sql)) {
for ($i = 0; $i < $columns_total; $i++) {
$output .=''.$row["$i"].',';
}
$output .="\n";
}

$filename = "emp.csv";
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename='.$filename);

Unfortunately not, php is server side the client would have to decide where to store the file from download as the browser doesn't interact with the client's computer and only displays what server-side tells it to it cannot interact with the clients computer this will only interact with the browser. 不幸的是,php不是服务器端,客户端必须决定下载文件的存储位置,因为浏览器不与客户端计算机交互,而仅显示服务器端告诉它的内容,而不能与客户端计算机交互,这会仅与浏览器交互。

so the answer in no unfortunately. 所以不幸的是答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM