tags:

views:

179

answers:

2

Hello Everyone,

I am developing an application that includes JPG and TIFF image size validation. The backend is done is done in PHP. I am wondering if there is anyway to validate the minimum width and height of those images in Flex or if they have to be uploaded to PHP and validated there.

Thank you in advance for any assistance,

Orville

A: 

Assuming you're talking about client-side validation, you could always load the image to an object in flex and test the width and height of the loaded image object manually.

However, this should be done in addition to server-side checking if this limit is important, as client-side checks can be circumvented by crafty users.

Walt W
+2  A: 

In Flash Player 10 the application can gain direct access to data on the client's machine. The new API methods are FileReference.load() and save(); you'll want to use load() to access the file off the user's machine and examine its properties. Details here:

http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html#load()

After the FileReference dispatches its complete event, the "data" property will be populated with a ByteArray of the file's contents. If you can find or write suitable libraries for JPEG and TIFF files then you should be able to examine the dimensions.

For Flash Player 9 and earlier, FileReference is limited to upload() and download().

cliff.meyers
Thank you. I wasn't aware of those changes in Flash 10.