This forum is for swapping tips or ideas with fellow users, suggesting new features, or showing of what you have created with the system etc, there is no guarantee of an answer to questions posted in the forum. All support questions must be submitted via the Support ticket system

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.

Pages: [1]
Author Topic: screenshot to server
Posts: 1
Post screenshot to server
on: June 19, 2012, 13:44

i am trying to upload screenshot to server using this code

#pragma strict


var screenShotURL= "http://www.d**";

var skaitlis:int;

// Take a screen shot immediately

function Start () {




function UploadPNG () {

// We should only read the screen after all rendering is complete

yield WaitForEndOfFrame ();


// Create a texture the size of the screen, RGB24 format

var width = Screen.width;

var height = Screen.height;

var tex = new Texture2D ( width, height, TextureFormat.RGB24, false );

// Read screen contents into the texture

tex.ReadPixels ( Rect(0, 0, width, height), 0, 0 );

tex.Apply ();


// Encode texture into PNG

var bytes = tex.EncodeToPNG ();

Destroy ( tex );


// Create a Web Form

var form = new WWWForm ();

form.AddField ( "action", "Upload Image" );

form.AddBinaryData ( "fileUpload", bytes, "screenShot"+skaitlis+".png", "image/png" );


// Upload to a cgi script 

var w = WWW ( screenShotURL, form );

yield w;

if (w.error != null) {

print ( w.error ); 

} else {

print ( "Finished Uploading Screenshot" ); 



function OnGUI(){

 if (GUI.Button(Rect(10,10,50,50),"spied")){





everything works fine, no problem at all
now i am trying to upload screenshot form Mega Grab
i just dont know haw can i asses this TexData array(it is more like noob qvestion) and do someting like this

form.AddBinaryData ( "fileUpload", TexData, "screenShot"+skaitlis+".png", "image/png" );

oh i need help whit this so bad 🙁

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.014 seconds.