user773737
user773737

Reputation:

Using javascript to move a file on a server

So I have this html page. Inside of it is a bit of javascript code that talks to a flash application.

During the flash application's lifecycle, it'll save a file to a place on the server using the javascript on the html page.

How can I use javascript to take the file I just saved and move it to a different location?

Upvotes: 0

Views: 1893

Answers (2)

user625529
user625529

Reputation:

As you said you have node js installed and running on the server,it is possible for you to move a file using the nodejs filesystem api: http://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback

For this to work you would need to monitor and detect when new files are saved in a certain folder, which should be possible using: http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener

Happy coding!

Upvotes: 0

zerkms
zerkms

Reputation: 254886

You cannot. Javascript works on a client and don't have an access to the server's filesystem.

You can only trigger a script on the server that does that.

Upvotes: 3

Related Questions