javascript - js plugin reads local files
PHP中文网
PHP中文网 2017-06-12 09:33:01
0
4
1180

I want to write a jq plug-in that allows the user to select a local file and then read the file. How can I select the file and then read it directly or get the absolute path? Both are acceptable.
However, after searching for a long time, I found that the absolute path problem is difficult to obtain due to security issues. Please provide solutions.

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
阿神

If you just want to read the file content for processing, you don’t need to know the local address. You only need to use the File API of html5. If you want to display something through the address, you should upload it to the background and return a network address.

You can check out my detailed summary:
Advanced JavaScript Learning (3) - File Operations Based on HTML5 File API

淡淡烟草味

is not because the absolute path problem is difficult to get due to security issues, so change is difficult to impossible .

typecho

Getting the local path is not possible, you can look at the File API

三叔

Upload to the background for parsing and then send it back to the front-end. The front-end js cannot read the file content directly

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