views:

416

answers:

1

Hello everyone,

I have a web page with a flex component, the flex component is responsible for creating an image from user inputs.

Once an image is ready the user enter some more information in the HTML form and click on the send form button.

When this button is clicked, javascript calls a function on the flex components which returns the image data as a base64 encoded string.

Then with Jquery i do an ajax POST to a django view. The image data is encoded as a string in the "data" option of the ajax POST.

Once the django view answers back i either redirect with a Javascript call or higlight any possible mistakes.

Is that the best way for what i want to achieve ? (sending form data + image to server at once)

  • Some form have multi encode part when dealing with files should i try to use it ? with ajax ? how ?

Thanks,

Greg

+1  A: 

As an alternative, you could have Flex submit the base64 image data directly to the server and handle the result. You can do this easily with the URLRequest class. You may want to test this out to see if it affects the client's performance; my guess is that pushing that much data through ExternalInterface to Javascript could cause the browser to hang for a bit.

Ultimately though it sounds like this Flex app is just a small component in your overall page, so it might make sense to keep the responsibilities of the Flex component as small as possible and do it through AJAX like you presumably handle the rest of your requests in the application.

cliff.meyers
Agreed - try to partition the Flex into just what you need it for.
le dorfier