Err...sorry that was a typo.
I've had trouble sending jpeg images to the server UNLESS they are
base64 encoded.
I'd like to send the data from the bytearray directly to the server,
but for some reason it seems that flash is only allowing the first
four bytes that identify the binary as a jpeg file to be sent. On the
server side, I just get 4 bytes. So I've resorted to first encoding
the data in base64, then decoding on the server.
I know this can easily be done with cold fusion, or web orb, but we're
not using them.
Rob
On Feb 27, 2009, at 6:49 AM, Anggie Bratadinata wrote:
I've never had any problems sending base64-encoded images to a
server (PHP).
Could it be a server issue that you had?
--
Anggie Bratadinata | www.masputih.com | Indonesia
On Fri, Feb 27, 2009 at 6:44 PM, Rob Kunkle <[email protected]>
wrote:
i've had a lot of trouble trying to send jpeg to a server with base64
encoding. It seems that flash only allows the first four bytes of the
byte array to be sent when it is a jpeg.
Anyone else come across this issue? I'd like to not base64
encoded/decode if possible.
--- In [email protected], "netdeep" <deep...@...> wrote:
>
>
> Can the data not be passed simply as a ByteArray instead of a base64
string? This is from
> the Adobe documentation for URLRequest:
>
>
> ---------------------
> data property
> An object containing data to be transmitted with the URL request.
>
> This property is used with the method property. In Adobe AIR, data
is sent when any HTTP
> method other than GET is used. In Flash Player, data is set when the
POST HTTP method is
> used.
>
> The URLRequest API offers binary POST support and support for
URL-encoded variables,
> as well as support for strings. The data object can be a ByteArray,
URLVariables, or String
> object.
>
> The way in which the data is used depends on the type of object
used:
>
> If the object is a ByteArray object, the binary data of the
ByteArray object is used as POST
> data. For GET, data of ByteArray type is not supported.
>
> -----------
>
> My problem is that I am also deficient in my experience with
servlets and don't know how
> to decode a byte array there, but this is how I send the byte array
>
>
> var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(component);
> var imageByteArray:ByteArray = imageSnap.data as ByteArray;
> var request:URLRequest = new URLRequest(imgServURL);
> request.data =
imageByteArray;
> request.method =
URLRequestMethod.POST;
>
navigateToURL(request);
>
>
>
>
>
>
>
>
>
> --- In [email protected], leds usop <rptlead@> wrote:
> >
> > without remoting, and using string param only, encode the image as
jpeg or png
> (depending on your requirement) . then convert it to base64 string
which you can pass to
> the serlvet via post (or get, whatever) . Then decode at the backend
accordingly as a jpeg
> file or png file which is you can make available to the user. This
is not the fastest solution
> performance-wise but it does get the job done expecially for
snapshots.
> >
> > --- On Thu, 6/26/08, netdeep <deepnet@> wrote:
> > From: netdeep <deepnet@>
> > Subject: [flexcoders] image snapshot in flex
> > To: [email protected]
> > Date: Thursday, June 26, 2008, 12:47 AM
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > I'd like to add a button so the user can snapshot a
graph in my flex app. I can do
> this storing
> >
> > it on the server with Java, but I'd like for the user to have
direct access to it. Since I
> don't
> >
> > think this can be done for instance saving to the desktop, I
thought the next best
> solution
> >
> > would be to send the image to say a new browser window, possibly
via a servlet? But
> I'm not
> >
> > sure how to do this or if this is the best solution. Any ideas or
examples of how this
> should
> >
> > be done? Here is a little snippet of the method I use to encode
the image into a
> byteArray:
> >
> >
> >
> > private function saveImage(e: ImageUpdateEvent ):void {
> >
> > var comp:UIComponent = e.comp;
> >
> > var imageSnap:ImageSnap shot = ImageSnapshot.
captureImage( comp);
> >
> > var imageByteArray: ByteArray = imageSnap.data as
ByteArray;
> >
> > imgSave.saveImage( imageByteArray, e.name+"-img.
png");
> >
> > }
> >
>