?
Solved

Get contentType for Flex FileReference upload?

Posted on 2009-12-22
2
Medium Priority
?
2,123 Views
Last Modified: 2013-11-11
Hi there,

I'm trying to make an image upload in flex, which, once uploaded, is sent to Amazon S3.
But, I need to know the MIME content type of the file.

For PCs, I can just check the file extension, but what about Macs? I know it's an image, but I don't know if it is gif, jpeg, etc.

I can't get Flex (on the client side) to determine the content type of the file reference. How can I do this?

I've seen this:
http://groups.google.com/group/flex_india/browse_thread/thread/881dbc640cbafc46
But again it relies on filename extensions, not available on Mac, I tihnk. (I don't have one.)
0
Comment
Question by:the_cyman
2 Comments
 
LVL 11

Assisted Solution

by:vindys80
vindys80 earned 2000 total points
ID: 26109126
Hi,

I just have knowledge of reading as I don't use a mac.

Did you tried "extension" property for FileReference?

The filename extension.

from definition of extension      property

A file's extension is the part of the name following (and not including) the final dot ("."). If there is no dot in the filename, the extension is null.

Note: You should use the extension property to determine a file's type; do not use the creator or type properties. You should consider the creator and type properties to be considered deprecated. They apply to older versions of Mac OS.

If this is not working may be you can try creator too I feel
0
 

Accepted Solution

by:
the_cyman earned 0 total points
ID: 26120485
Hi there,

That works, but only for Adobe desktop apps in AIR.

But, I found this code, I couldn't get it working properly, but there's a live sample. In the end, I just checked the first 3 bytes of the files on the webserver end to determine the image type, since those first three bytes are header data that describes the file type.

Code to verify in content type in flex:
http://ntt.cc/2008/11/21/tutorials-about-using-flash-player-10-to-verify-the-files-type-filereference.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question