[英]If I don't care about security, is there a way to do file IO with client side programming (specifically, JS)?
I realize this is a HUGE , MASSIVE security risk, but I have my reasons. 我意识到这是巨大的 , 大规模的安全风险,但是我有自己的理由。 I'm not asking whether it's a good idea, just whether it is possible at all. 我不是在问这是否是个好主意,只是问是否有可能。 Doesn't necessarily need to be JS, but it does need to be browser based and client side. 不一定需要是JS,但确实需要是基于浏览器和客户端的。
Specifics: 细节:
And @Cheeso, definitely not a virus. 还有@Cheeso,绝对不是病毒。 This is more theoretical than anything at this point. 在这一点上,这比理论上的要重要。
Do you speak HTML5? 您会说HTML5吗? Can you force your users to use Google Chrome? 您可以强迫用户使用Google Chrome吗? You can use the filesystem API: here you can find what you need to start reading/writing files . 您可以使用文件系统API: 在这里您可以找到开始读取/写入文件所需的内容 。
You just added "read and write to a server -side file" to your description... and that's a HUGELY different question. 您刚刚在描述中添加了“读写服务器端文件” ...这是一个完全不同的问题。
If you want to read/write a client -side file, and you can't just have a file upload/download like normal websites, you should look into using a signed Java applet (see this website for details) - IIRC Facebook used such an applet in its early days so users could upload multiple photos at a time. 如果您想读取/写入客户端文件,而不能像普通网站那样仅上传/下载文件,则应考虑使用签名的Java小程序(有关详细信息,请访问此网站 )-IIRC Facebook使用了一个小应用程序,因此用户可以一次上传多张照片。 Java applets seem to be going the way of the dodo, though, so YMMV. 但是,Java applet似乎正像dodo一样。
But if you want to read/write a server -side file, then just about any server will be able to do that, without any browser-side trickery. 但是,如果您想读取/写入服务器端文件,那么几乎任何服务器都可以做到这一点,而无需任何浏览器端的麻烦。 Google is your friend, ie look up "PHP write to file." Google是您的朋友,即查找“ PHP写入文件”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.