0

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

File create
File write
File read
Update
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!

Mohit Kumar Gupta
  • 362
  • 1
  • 6
  • 21
  • You can't read or write files at the client side with Javascript, with an exception being ``. It's a security issue. – Butt4cak3 Jan 24 '14 at 09:16
  • 1
    Maybe you should specify WHICH filesystem you are wanting to destroy, cough! ..operate with.. :) As client side Javascript operates on your (client) machine and comes from a server, you may specify if you want to modify files on the client machine (security risk), or on the server (you connect and upload/remove a file). Of course that is different from Server Side Javascript (Node.js) that can operate on files quite well. – FrancescoMM Jan 24 '14 at 09:21

2 Answers2

2

No you can't do such type of operation on browser.

You need Server Side JavaScript Node.js.

There are lot of details in Filesystem

Write a file example

var fs = require('fs');
fs.writeFile("yourpath", "Hello", function(err) {
    if(err) {
        console.log(err);
    } else {
        console.log("The file was saved!");
    }
}); 
Prateek
  • 6,785
  • 2
  • 24
  • 37
1

No you cannot do this kind of operations on all browsers.

The functionality you are looking for can be accomplished using ActiveX in Internet Explorer only

Html 5's File Api also exist but has many limitations:

Items in one application’s Sandbox are invisible to others.

Items in the Sandbox is invisible to other types of web browsers. For example, a Sandbox created in Google Chrome is invisible to other non-Chrome browsers.

Items in the Sandbox is invisible to non-browser programs.

For more info on this visit this

Community
  • 1
  • 1
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125