Search Unity

editing text file on local server

Discussion in 'Scripting' started by pat_sommer, Apr 22, 2013.

  1. pat_sommer

    pat_sommer

    Joined:
    Jun 28, 2010
    Posts:
    586
    hi,

    i am trying to read and write a text file from a local server computer from multiple iPads.

    i am able to read the text file easily using

    Code (csharp):
    1.  
    2.  
    3.  www = WWW (path);
    4.  
    5.     // Wait for download to complete
    6.     yield www;
    7.    
    8.     downloadedString = www.text;
    9.     guiText.text = downloadedString;
    10.  
    11.  
    but i am unable to write to the text file,
    I've tried using

    Code (csharp):
    1.  
    2.  
    3.  // Create a Web Form
    4.     var form = new WWWForm();
    5.     form.AddField("frameCount", Time.frameCount.ToString());
    6.  
    7.     // Upload to a cgi script
    8.     var w = WWW(path, form);
    9.     yield w;
    10.     if (w.error != null)
    11.         print(w.error);
    12.     else
    13.         print("Finished Uploading");
    14.        
    15.  
    I've also tried to use StreamWriter, but its keeps adding the Application.dataPath automatically to the path and can not find the folder.

    any input on what I'm doing wrong?
    thanks
     
  2. CahMan

    CahMan

    Joined:
    Apr 3, 2013
    Posts:
    53
    Hi Pat,

    What does the script on the server side look like? If you're not getting any errors out of WWW when you try to write, then it's probably something wrong on the server side.

    Cheers,
    Cahman