- Home /
save / load xml file on a web server
Hi I am building an online tests system for a school , where the questions and answers are saved in an xml file on the school website server , the problem is i don't know how can i save the xml file on the server and how can i call it back ? My Code till now using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Xml.Serialization; using System.IO; using System; public class XMLSerializer : MonoBehaviour { public string studentname;
public void fff() {
string path = "d:/" + "studentanswer"+ ".xml";
Debug.Log (path);
XmlSerializer serializer = new XmlSerializer (typeof(Level1));
Level1 ak47 = new Level1{ Items=new [] {new mainitems { Question = "a", Answer = "2" },new mainitems { Question="b",Answer="5"}}};
StreamWriter writer = new StreamWriter(path);
serializer.Serialize(writer, ak47);
writer.Close();
}
}
Answer by Bunny83 · Feb 28, 2017 at 01:05 PM
You can not simply "save a file to a webserver". A webserver is a resource provider. If a client should be able to store anything on the server you need a server side script that handles such a request.
For a simple example see the Server Side Highscore examples. Note that if the data is somewhat confidential and you host your server on the internet you would need some sort of authenticaion for the users as otherwise everybody on the world can use your server.
Your answer
Follow this Question
Related Questions
Problem reaching highscore board - crossdomain.xml issue? 1 Answer
Getting XML Data for levels from server 0 Answers
Where will those XML files be stored if the platform of this game is Web Player...? 1 Answer
Is it possible to add a specific prefab and custom user text in in a multiuser web player? 0 Answers