Skip to main content
Known Participant
July 26, 2013
Question

Upload an image and save it as an .png file?

  • July 26, 2013
  • 1 reply
  • 680 views

How do I upload an image to Adobe Media Server?

Here's what I'm trying to do. I have a sharedObject that I want to store my thumbnail in.

sharedObject = SharedObject.getRemote("thumbnail",mync.uri,false);

sharedObject.client=this;

sharedObject.connect(mync);

Then I get the image and send it

var screenshot:BitmapData = new BitmapData(VD1.width,VD1.height,false);

var encoder:PNGEncoder = new PNGEncoder();

var pngByteArray:ByteArray = encoder.encode(screenshot);

pngByteArray.compress();

sharedObject.send("saveThumbnail", pngByteArray);

But this code doesn't do anything. I'm probably going about it the wrong way.

The ActionScript3 reference says that you can:

Store and share data on Flash Media Server. A shared object can store data on the server for other clients to retrieve

However, I don't want other clients to retrieve it. I just want it to be stored on the server as a .png. How can I do this?

    This topic has been closed for replies.

    1 reply

    Petro_O__Bochan
    Inspiring
    August 1, 2013

    Hello, for this to work you’d need to first use middleware such as PHP, CF, .NET, Java, etc. This is needed since your binary data outgoing from Flash Player and it needs to undergo (de)serialization. Here is a sample done in CF - http://snapshots.pbochan.com.

    Known Participant
    August 1, 2013

    Actually, I got this to work by sending the byteArray to the server, and then writing the byteArray to a new file.