最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

File operation using Javascript or jQuery - Stack Overflow

programmeradmin7浏览0评论

I want to make some file operation using Javascript or jQuery like:

  1. File create
  2. File write
  3. File read
  4. Update
  5. Remove/delete

Is it possible to do above stuffs? If possible, from where I can get the idea? Please suggest me.In any end (client/server) how can it be done?i asked this just for know!

I want to make some file operation using Javascript or jQuery like:

  1. File create
  2. File write
  3. File read
  4. Update
  5. Remove/delete

Is it possible to do above stuffs? If possible, from where I can get the idea? Please suggest me.In any end (client/server) how can it be done?i asked this just for know!

Share Improve this question edited Apr 24, 2011 at 13:18 thecodeparadox asked Apr 24, 2011 at 13:04 thecodeparadoxthecodeparadox 87.1k22 gold badges142 silver badges164 bronze badges 6
  • Where - on client side, or on server side? What is your end goal with this? – Pekka Commented Apr 24, 2011 at 13:07
  • 2 Assuming you're talking about in the browser: Thank god you can't. If you can, malicious scripts can, too. – user395760 Commented Apr 24, 2011 at 13:07
  • @delnan hi friend. i'm not finding these for any malicious purpose. So if you predict something like that, you are wrong.Thanks for your ment. – thecodeparadox Commented Apr 24, 2011 at 13:34
  • @Pekka hi bro, on client and both server side both. I want to know this not for malicious purpose.Dont't predict something like that. Help me.As a new programmer its my curiosity. – thecodeparadox Commented Apr 24, 2011 at 13:35
  • 1 I'm not saying you have malicious intents. But browser JS runs in a sandbox for a reason - incredible potential for malware otherwise (heck, even with the sandbox people find ways to abuse it!). – user395760 Commented Apr 24, 2011 at 13:36
 |  Show 1 more ment

3 Answers 3

Reset to default 2

There are 2 HTML5 APIs of interest.

The File API which allows you to read files (of a users choice). Most modern browsers implement this.

The File Write API which allows you to write to files. No browsers implement this as of now.

I presume you can also use IE only ActiveX controls to do file manipulation on windows.

In any end (client/server)

You weren't specific about which server side JS implementation you are using, so for Node.js:

See the file system section of the Node.js documentation

As I can understand from your question you are trying to do file operation at client end. If you are using IE and windows operating system, you can do that using FileSystemObject. This doesn't work for other browser and other operating systems as FileSystemObject is ActivexObject given by Windows. For details refer http://www.codeproject./KB/scripting/JavaScript__File_Handling.aspx

发布评论

评论列表(0)

  1. 暂无评论