javascript - How to implement txt file browsing function on the website?
ringa_lee
ringa_lee 2017-05-19 10:09:57
0
2
544

We want to make an online reader, which needs to support users to drag in a txt file and then open it for viewing.
How to achieve this?

We searched for some methods on the Internet, and some directly used iframe src="xxx.txt", but when opened, the code was garbled.
Please help me.

ringa_lee
ringa_lee

ringa_lee

reply all(2)
迷茫

First of all, txt on win is mostly encoded by gbk, and browsers now use utf-8 by default

You can use ajax to get the txt and then write it to the page

淡淡烟草味

Txt files are generally not big, you can transfer the file to the server when the user drags it in
Then it will be parsed by the server and displayed to the front desk

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template