almost 11 years ago
Most of the apps or games allowed to the user to upload his screen shorts on the server for latter user.
Today I am going to show how to upload screen shot to server in Unity3D.
- private string url = "www.mysiteURL";
- Texture2D screenShot = Application.CaptureScreenshot("Screenshot.png");
- WWW form = new WWWForm();
- form.AddField("UserName","Inder");
- form.AddField("Password","Singh");
- form.AddBinaryData("ScreenShot",screenShot.EncodeToPNG);
- WWW www = new WWW(url,form);
- yield www; // Wait until the uploading is done
- if(www.error)
- {
- print("Login not successfully...");
- }
- else
- {
- print("Login successfully...");
- // Apply your code here now...
- }
private string url = "www.mysiteURL"; Texture2D screenShot = Application.CaptureScreenshot("Screenshot.png"); WWW form = new WWWForm(); form.AddField("UserName","Inder"); form.AddField("Password","Singh"); form.AddBinaryData("ScreenShot",screenShot.EncodeToPNG); WWW www = new WWW(url,form); yield www; // Wait until the uploading is done if(www.error) { print("Login not successfully..."); } else { print("Login successfully..."); // Apply your code here now... }
Enjoy Coding.. :)
0 Comment(s)