0

I'm in need help in coding a web page in HTML5 where I can browse a file and enter a name in a text box and specify a location so that the portal can rename and save the file at location specified.

The problem is I'm not supposed to use any server side languages like PHP or Perl.

Is there a way that I can achieve this using JavaScript or jQuery or any Client side executable languages.

Any insight is much appreciated.

1
  • Javascript can only load local files (such as XML), but cannot modify it or move to other folders. Commented Apr 30, 2015 at 20:50

2 Answers 2

4

No. That would be an enormous security loophole. You cannot programmatically change the client's file system.

Sign up to request clarification or add additional context in comments.

3 Comments

This is not a server controlled management. I want to organize my files using a webpage without installing any server services like Apache. So I don't think there will be any issue of security loophole.
@sathyam1992 that's not what I was saying; browsers simply don't allow unlimited access to the file system because someone could write some malicious code that, when you visit their webpage, deletes all your files or something terrible.
This has recently changed. Browsers can modify local files if they support the File System Access API.
0

You can do it with the fs (filesystem) api in node.js.

var fs = require("fs");

fs.rename("/tmp/hello", "/tmp/world", function (err) {
    if (err) {
        throw err;
    } else {
        console.log("rename complete");
    }
});

8 Comments

Technically this is true, but the OP wants to know about client side.
OP specifically said The problem is I'm not supposed to use any server side languages
Hey guys a friend of mine requested me to build him a page for which he want to run without installing a server.
He need this so that he can save files in organized manner. He have tons of documents lying in Downloads folder. I hope you understand the need of this.
@lem2802 Thank you for the snippet. I wonder if this works in windows FS. Say the file is in C:/Test and the target is D:/Test, will this still work?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.