[英]How to load file into javascript
I have an HTML table that should be updated according the file that user uploads. 我有一个HTML表,应该根据用户上传的文件进行更新。 In other words, I would like user to be able to upload a file, and change the contents of the table according to file content.
换句话说,我希望用户能够上传文件,并根据文件内容更改表的内容。 The file size can be several MB.
文件大小可以是几MB。 What are my options ?
我有什么选择? Do I must to upload the file to a server, or it can be done in client side ?
我是否必须将文件上传到服务器,或者可以在客户端完成? Thanks !
谢谢 !
No, you cannot manipulate files on the client side. 不,您不能在客户端上操作文件。 Unless you convince the user to turn off security for your application.
除非您说服用户关闭应用程序的安全性。
You can upload the file in pre-determined XML format and then bind HTML table to XML data island. 您可以以预定的XML格式上传文件,然后将HTML表绑定到XML数据岛。
See this example: http://www.users.cloud9.net/~bradmcc/xmlisland.html 请参见以下示例: http : //www.users.cloud9.net/~bradmcc/xmlisland.html
Although, I'm not sure if this technique works with Chrome. 不过,我不确定该技术是否适用于Chrome。
唯一的方法是将文件上传到服务器,在该服务器上处理文件,然后返回一组需要插入到页面中的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.