Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it's a little tricky: You can do it one of two ways:</p> <p>Arthem posted this in another thread:</p> <blockquote> <p>This was of great help to me: <a href="http://www.quietless.com/kitchen/upload-bitmapdata-snapshot-to-server-in-as3/" rel="nofollow noreferrer">http://www.quietless.com/kitchen/upload-bitmapdata-snapshot-to-server-in-as3/</a></p> <p>You need to modify the URLRequestWrapper to insert field names and file names where needed. Here's what I've done:</p> <p>bytes = 'Content-Disposition: form-data; name="' + $fieldName + '"; filename="';</p> <p>It does the most formatting of headers so the server could understand it as a file upload.</p> <p>By the way, if you have a BitmapData you might need to encode it to JPEG or PNG first.</p> </blockquote> <p>And I usually use this solution:</p> <p>I haven't used the imageshack API, but you may want to try using adobe's JPGEncoder class - here's a quick example that passes a username and the JPG's byte array, it's really quite simple.</p> <pre><code>private function savePicToServer(bmpData:BitmapData):void { var jpgEncoder:JPGEncoder = new JPGEncoder(85); var jpgStream:ByteArray = jpgEncoder.encode(bmpData); var loader:URLLoader = new URLLoader(); configureListeners(loader); var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream"); var request:URLRequest = new URLRequest(ModelLocator.BASE_URL + ModelLocator.UPLOAD_URL + "?user=" + ModelLocator.getInstance().username); request.requestHeaders.push(header); request.method = URLRequestMethod.POST; request.data = jpgStream; loader.load(request); } </code></pre> <p>Note that the variables are passed as part of the query string. You can't use URLVariables, as several people have suggested, as the URLVariables would be stored in the request's data property, which we are already using to pass the byteArray.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload