Uploading BitmapData as photo instead of file from disk

50 views
Skip to first unread message

Wouter VdB

unread,
Feb 10, 2009, 6:03:24 AM2/10/09
to ActionScript 3 Flickr Library
Hi,

I'm trying to upload the content of a BitmapData instance as a photo
to Flickr. Has someone succeeded in doing this and willing to share
the outline of how to do it?

What I've tried so far: The upload.upload() function takes a
FileReference, which cannot be 'populated' by the content of the
BitmapData (so it seems). I'm trying to write an alternative using a
URLLoader with a URLRequest with POST as URLRequestMethod, but I
haven't yet figured out how to add the api_key/auth_token/etc name-
value vars together with the result of the PNEncoder in the POST's
payload...

Wouter VdB

unread,
Feb 19, 2009, 12:32:46 PM2/19/09
to ActionScript 3 Flickr Library
Hi,

FYI: I managed to upload an image based on BitmapData by manually
constructing the HTTP POST, as described here:
http://marstonstudio.com/2007/08/19/how-to-take-a-snapshot-of-a-flash-movie-and-automatically-upload-the-jpg-to-a-server-in-three-easy-steps/.
This works nicely from the bin, but when deployed, a 2170 Security
sandbox violation error is thrown (in Flash 10).

I assume this problem error is thrown because allow-http-request-
headers-from is missing from http://api.flickr.com/crossdomain.xml. Is
this correct?

I will try to explain this to Flickr and try to get them to add allow-
http-request-headers-from. However, I suppose that Adobe probably has
more leverage then myself ;), so if someone at Adobe could look into
this as well, that would be neat!

TIA

wouter

Wouter VdB

unread,
Mar 2, 2009, 4:28:05 AM3/2/09
to ActionScript 3 Flickr Library
Hi,

I have posted a request to add the allow-http-request-headers-from
element in the cross-domain policy file of the Flickr API. You could
help by adding a reply with your support for this request.

request: http://tech.groups.yahoo.com/group/yws-flickr/message/4760

Thanks!

wouter

goodlux

unread,
Apr 11, 2009, 9:56:28 AM4/11/09
to ActionScript 3 Flickr Library
Don't know if you've seen this, but maybe it will help you (see
below). I think the example you referenced in your original post was
done in flash 9.

Hope this helps...
--

From http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html


POSTs containing file uploads require upload security checks

When a SWF file performs an upload to a server, using the
FileReference.browse and FileReference.upload methods, Flash Player
enforces two security rules:

* FileReference.browse must be called from within a user-event
handler (mouse or keyboard event)
* If the upload goes to a server in a different domain than the
SWF file calling FileReference.upload, a policy file is required on
the target server, trusting the domain of the SWF file

Starting with version 10,0,2, Flash Player enforces these same two
rules at the time any networking API is called to perform a POST that
will appear to the server to contain an upload. The format for these
uploads is called RFC1867, and it consists of a Content-Type of
"multipart/form-data", with a section in the POST body that includes a
"filename" attribute in a "Content-Disposition" header.

----
Reply all
Reply to author
Forward
0 new messages