[英]Find user desktop path using either javascript or jquery
how to find user desktop location using jquery or javascript? 如何使用jquery或javascript查找用户桌面位置? in my project i have to create and save prn file to user desktop location,file creation is done by below php script. 在我的项目中,我必须创建prn文件并将其保存到用户桌面位置,文件创建是通过以下php脚本完成的。
<?php
$handle = fopen("file1.prn", "w");
fwrite($handle, "prn format");
fclose($handle);
readfile('file1.prn');
exit;
?>
i already tried with php script to save in user desktop, but no proper solution i found. 我已经尝试使用php脚本保存在用户桌面中,但是没有找到合适的解决方案。 is this possible in javascript or jquery? 这可能在javascript或jquery中吗?
Thanks in advance.. 提前致谢..
I'm not an expert, but Javascript same-origin policy make this impossible without a confirmation action by user. 我不是专家,但是如果没有用户的确认操作,Javascript同源策略将无法实现。
Try something like : 尝试类似的东西:
<input type="file" id="fileinput" />
Then : 然后 :
function readSingleFile(evt) {
var f = evt.target.files[0];
if (f) { }
}
document.getElementById('fileinput').addEventListener('change', readSingleFile, false);
Once f is opened, you just have to write in it =) 一旦打开f,您只需要在其中写=)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.