Web Hosting Talk







View Full Version : Can javascripts read and write to files


steve45
08-01-2009, 10:57 AM
I have no knowledge in JavaScript.

I am developing a website through which people could register for a webspace account, and then start uploading their web pages, that will be visible on the internet.

If I allow people to upload php scripts, I know that they will be able to read and write to files and folders to which they have permission in my server.

Similarly, if I allow people to upload JavaScript, or allow them to upload HTML pages in which there are java-scripts, will they be able to read and write, to files and folders in my server?

Thanks.

cselzer
08-01-2009, 11:18 AM
no. Javascript alone, cannot read/write to a server.

Let me rephrase, it can read, but only through ajax.. it has to be visible in the public_html (or www in some cases, or even htdocs) for it to be able to read it.. its just another web request basically.

mwatkins
08-01-2009, 11:22 AM
As cselzer said - no.

http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.5/reference/

You'll find no mention of fopen or other file handling capabilities. You can write to a cookie file, but that's about it, and even that will require a *client* (typically a browser) running on your server to be able to write that cookie file to your server.

If you are going to offer a public page hosting service you should really do some basic web dev tutorials so that you can better understand how everything hangs together. You can't possibly hope to manage such a system properly unless you do have a basic grasp of what others will be doing on *your* system.

larwilliams
08-01-2009, 12:17 PM
JavaScript alone cannot, as it is just a client-side language (meaning limited to the web browser itself). Used in combo with PHP or other language, it can.

Read up :)

steve45
08-02-2009, 03:16 AM
Thanks a lot folks for the clarification :-)

Since I am not in a hurry to somehow finish this project, I am very cautions when developing this site. Just want to make sure that I don’t allow people to damage the server, or mess with other’s data.

I really appreciate all your help.

Thanks.