Вопрос

We can drag a file to browser and read it's content. But is there any way where we can write back to same file ?

Это было полезно?

Решение

Short answer: No. The browser cannot arbitrarily write a file to the local file system. When a user drags a file onto the browser, this is user-driven action whereby the user's action grants the browser approval to access the file. However, that file is simply opened by the browser for read-only purposes; it cannot make change and save it back.

The "File System API" does not provide read/write access to the client/local file system. This is probably the biggest misunderstanding about the File System API, probably because the name of the API give the impression that it can do something it really can't.

I covered this more fully in my reply on JS Filesystem API: accessing JS FileEntry's on local system?.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top