简体   繁体   中英

How to load file into javascript

I have an HTML table that should be updated according the file that user uploads. 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. 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.

See this example: http://www.users.cloud9.net/~bradmcc/xmlisland.html

Although, I'm not sure if this technique works with Chrome.

唯一的方法是将文件上传到服务器,在该服务器上处理文件,然后返回一组需要插入到页面中的值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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