Skip to content Skip to sidebar Skip to footer

Xmlhttprequest() Post Does Not Appear As File On Server

As far as my limited understanding goes, this function should create a file on the server containing the text string returned by the function NewFileToSave(): function SaveDay() {

Solution 1:

That makes a POST request to the server with whatever the return value of NewFileToSave() is as the body of the request. (Since the file doesn't exist already, you'll probably get a 404 Not Found response).

If you want to create a file on the server, then you need the server to run a program that will read that data and use it to create a file (and you probably want to be using a PUT request instead of a POST request, to specify the Content-Type request header, and to add some kind of authentication/authorisation layer to the system).

The specifics of how you might go about that depend on which HTTP server you are using and your programming language preferences.

An arbitrary POST request to an arbitrary HTTP server won't create an arbitrary file. That would be a huge security hole.

Post a Comment for "Xmlhttprequest() Post Does Not Appear As File On Server"